Taher
Taher

Reputation: 752

Assets (images, JS and CSS) not getting served after upgrading to Rails 4.2.0 in production

The error that I am getting is

"No route matches [GET]...."

I have already tried doing following things in environments/production.rb

# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true

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

PS : I am using Apache2 for hosting my rails app

Upvotes: 2

Views: 306

Answers (2)

Taher
Taher

Reputation: 752

This was the issue

config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

I did not have and environment variable and it was causing an issue.

For people who land upon this question

Upvotes: 0

doug
doug

Reputation: 2111

I've had more issues upgrading from rails 4.1 to rails 4.2 then I've had upgrading between any other version of rails ever. I use nginx, but go ahead and please try the following:

  • prefix the following commands with RAILS_ENV=production and run rake tmp:clear, rake asset:clean and rake asset:precompile
  • config.assets.compile = false
  • config.serve_static_files = false

Upvotes: 1

Related Questions