How To Call A View Helper Method In JavaScript Using Rails 3.1
I'm working on a simple app that needs to render a time. But the time must be formatted the way time_ago_in_words helper does. I'm getting the time data from a JSON object. Is it p
Solution 1:
You can't do it from inside a javascript function.
Ideally you would want a JSON equivalent to XML Builder where you could call the view helper methods from inside a .builder partial. This gem provides similar functionality https://github.com/lassebunk/api_builder.
Post a Comment for "How To Call A View Helper Method In JavaScript Using Rails 3.1"