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
Written by Joe Connor
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#