javascript_include_tag Rails 4 generating “/javascripts/” instead of “/assets” in production

后端 未结 5 1747
野趣味
野趣味 2021-02-01 02:31

I have a Rails 4 application with

<%= javascript_include_tag \"modernizr\", \"data-turbolinks-track\" => true %>

in the head. In deve

5条回答
  •  青春惊慌失措
    2021-02-01 03:22

    I have a new application using Rails 4 deployed on Heroku with :

    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
    

    my javascript application.(fingerprint).js called from the src: assets/application.js

    i think your problem come from something into your production.rb who define assets from another location.

    So maybe you can add Moderniz.js to

    config.assets.precompile = ['.js', '.css', '*.css.erb']

    in config/production.rb

    Or simply require modernizr script into your application.js

    //= require mordernizr

    and remove the modernizr script call into your layout.

    <%= javascript_include_tag "modernizr", "data-turbolinks-track" => true %>
    

    Can you check from where your application.js is served into your production environment ?

提交回复
热议问题