4a8ala
Last Updated: February 25, 2016
·
2.973K
· wildtangent

Rails 4 javascript_include_tag Gotcha

If you have a asset manifest file e.g.

= javascript_include_tag("admin/admin")
=> /app/assets/javascripts/admin/admin.js.coffee

The javascriptincludetag helper doesn't pick this up properly, instead giving you:

/javascripts/admin/admin.js

The correct way in Rails 4 appears to be

= javascript_include_tag("admin/application")

Rename your admin/admin.js.cofeee=> admin/application.js.coffee and it will correctly render

/assets/admin/application.js

Not sure why but it caught me out