Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionController::RoutingError (No route matches [GET] "/assets/images/control_top.png"): in rails 3.2.8

Tags:

Background image is not uploaded in my view page.showing this error.

ActionController::RoutingError (No route matches [GET] "/assets/images/control_top.png")

what can i do to resolve this problem?

like image 324
Inaccessible Avatar asked Jan 25 '13 10:01

Inaccessible


3 Answers

In production env, Rails will not be responsible for serving static assets. Therefore, you are getting this error.

This is controlled by this setting in config/environment/production.rb in your application:

config.serve_static_assets = false

You can set to that true

or try this

rake assets:precompile 

command (compiles and copies images, css and js from app/assets to public/.

like image 68
Sachin R Avatar answered Oct 12 '22 11:10

Sachin R


If you upgrade to a new version of Rails (Rails 4 and Rails 3.2.16 come to mind), and you suddenly start to see this error, it is likely that your stylesheet is pointing to the non-fingerprinted, non-cached version of the files. If you are using the asset pipeline, in order to take advantage of it, you need to use the new helpers that point to the fingerprinted, cached version of the files. To do so, you'll need to either embed erb in your css file, or use sass.

Incorrect (uses sass):

.class
  background: url('asset.png') no-repeat

Correct (uses sass):

.class
  background: image-url('asset.png') no-repeat

For more info, see here: http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets

like image 23
Aaron Gray Avatar answered Oct 12 '22 12:10

Aaron Gray


Might help someone , i tried all the answers and forgot the most basic thing to do . Clearing the browser cache , once done i was good to go :)

like image 39
Caffeine Coder Avatar answered Oct 12 '22 10:10

Caffeine Coder