chadwtaylor
chadwtaylor

Reputation: 231

Rails 3.2.2 assets not working in production mode

Disclaimer: I have looked all over but there are too many solutions to the problem which did not work for me hence this post.

Developed a simple website using Rails 3.2.2 in development mode got all assets working fine. When I switched to use production (ie: rails server -e production), the assets breaks and I get the ActionController::RoutingError (No route matches [GET] "/stylesheets/application.css") error.

I haven't changed the production.rb file.

Thanks for helping this frustrated human being... :)

Upvotes: 0

Views: 1093

Answers (3)

Weston Watson
Weston Watson

Reputation: 5724

I just had the same issue. I forgot to add my files to config.assets.precompile...

Rails assets working in development and not production

in my config/environments/production.rb I had to add a list of non default assets (like plugins)...

config.assets.precompile += w%( jquery.plugin.js awesome.css etc )

Upvotes: 0

user471245
user471245

Reputation: 191

In production.rb try config.serve_static_assets = true

Upvotes: 0

Samy Dindane
Samy Dindane

Reputation: 18736

You should precompile the assets before deploying the project.

bundle exec rake assets:precompile

Upvotes: 4

Related Questions