Search code examples
ruby-on-rails-3asset-pipelineassetsruby-on-rails-2

Assets not being served by assets pipeline in Rails 3


I am migrating a big application from Rails 2 to Rails 3. I added some images to app/assets/images. i.e. app/assets/images/key.png

If I go to http://localhost:3000/assets/key.png I dont see the image. In the server log I see that it was not found and one of the controller started to process the request.

Started GET "/assets/key.png" for 127.0.0.1 at 2013-03-19 17:44:31 -0300
Served asset /key.png - 404 Not Found (49ms)
Processing by DfcController#index as PNG
  Parameters: {"path"=>"assets/key"}

In development.rb I have the lines:

config.assets.debug = true
config.serve_static_assets = false

And in application.rb I have the lines:

config.assets.enabled = true
config.assets.version = '1.0'

Any help?


Solution

  • You should change

    config.serve_static_assets = true
    

    in your development.rb. Because during development, your rails application server acts as your web server too and should serve the static assets.