Rails 3.2.8 Application.js and Application.css are not working as expcted

后端 未结 4 1266
野性不改
野性不改 2020-12-31 11:04

When i try to include

<%= stylesheet_link_tag    \"application\" %>
<%= javascript_include_tag \"application\" %>

The content

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 11:56

    I was also having this issue but with newer versions of Rails and Ruby.

    Examining the log, I was being served javascript.js from Rails cache as the server didn't see a change in the file. I went and moved the require lines around (just one) to tell Rails that there's a change in the file and re-compile/use. Wellm that did it for me!

    Hope it helps somebody.

    Another important finding is to upgrade your sprockets gem in your Gemfile.

    I had version 2.2.1 and had issues, after upgrading to 2.2.2, it worked

    gem 'sprockets', '2.2.2' 
    

提交回复
热议问题