rails: Assets not being served correctly

I’m not sure how it happened, but yesterday after updating RVM and switching to rails 3.1.0.rc6, I get errors such as this:

ActionController::RoutingError (No route matches [GET] "/stylesheets/application.css")

I’ve tried locking sprockets to older versions (beta.10, beta.12, beta.14), switching to rails stable, rc5, rc4, rc1, and fiddling with assets config to no avail.

I saw that others had dealt with this recently, but I can’t seem to figure out how the hell to fix this. Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 43 (11 by maintainers)

Most upvoted comments

@FestivalBobcats: add one more require to your application.rb and try again:

require "sprockets/railtie"

@gabrielengel Are you sure that’s wise? If we set compile to true for production.rb wouldn’t every web request make the app run through the asset pipeline in order to generate the correct URLs?

Sounds problematic, performance-wise – unless Rails uses a hidden internal cache somewhere.

I had the same problems and found it’s caused by having active_reload in the Gemfile. Removing the gem active_reload from the Gemfile solved all assets problems for me. And it’s not needed with rails 3.2 anyway.