rails 3.1 assets are not available

旧街凉风 提交于 2019-12-09 14:10:28

问题


I started playing around with rails 3.1.rc4 but the first problem I'm having is that the assets are not available. I created a brand new project and in the index page the rails image gives 404. Actually any assets are available.

I checked

# application.rb
# Enable the asset pipeline
config.assets.enabled = true

And I tried

config.assets.paths << "#{Rails.root}/app/assets/images"

and also from the shell

$ rake rails:update
$ rake assets:clean
$ rake assets:precompile

had no luck, so I destroyed the gemset and I made another one reinstalling rails, but nothing worked so far.

Any ideas? - thank you


回答1:


I had the same problem and resolved it by forcing Rails to use sprockets beta10 instead of beta12 in the Gemfile:

gem 'sprockets', '2.0.0.beta.10'

And then running

bundle update sprockets

Another fix might be to install Rails 3.1.0rc5. The problem seems to be incompatibility between Rails and Sprockets and is detailed here. I guess this problem will be resolved when the final version of Rails 3.1 arrives.



来源:https://stackoverflow.com/questions/6883519/rails-3-1-assets-are-not-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!