I have a view helper, let say (for simplicity's sake)
def call_alert
return "alert 'this should appear'"
end
Then I have a coffeescript file some_test_page.js.coffee which renders for an action which is called via ajax. Inside this some_test_page.js.coffee I have:
<%= call_alert %>
When I do an ajax call to /some_test_page, I usually would expect to get a response with the compiled javascript from the coffeescript file and an alert would occur. However, it seems the view helper I tried to use cannot be accessed.
If I put a simple
alert 'this should appear'
inside my some_test_page.js.coffee file it works fine.
I feel like this should be ok, but maybe I'm doing something counter-convention or stupid?
How can I get the view helpers from application_helper.rb inside my coffeescript view files?