简体   繁体   中英

How to solve ' No route matches [GET] image.png ' when I moved image to assets image path?

I moved image to assets/images path from public/images

I have image:

 <%= image_tag("login_logo.png", :id => "login_logo") %>

I moved it from public folder to assets and changed path.

It is visible and working ok, but I get error in my console:

Started GET "/assets/logo_PG.png" for 127.0.0.1 at 2012-10-10 23:42:53 +0300
 Served asset /logo_PG.png - 304 Not Modified (0ms)

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

How can I solve this ?

Everything in subdirectories of assets (regardless whether it is an image, JS, etc.) is by default available under /assets/name.extension . So just make sure you refer to the image with the path /assets/login_logo.png , or use the asset_path helper:

<%= asset_path('login_logo.png') %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM