开发者

Rails 3: On a local server (# rails server), my images weren't found, although the correct location is given

开发者 https://www.devze.com 2023-03-01 07:10 出处:网络
I started the rails server with rails server. My images are in public/images, i.e. the image public/images/rails.png is put into html with <img src=\"/images/rails.png\" /> just as the image_ta

I started the rails server with rails server.

My images are in public/images, i.e. the image public/images/rails.png is put into html with <img src="/images/rails.png" /> just as the image_tag helper generates it.

But by any reason, the picture isn't found开发者_StackOverflow. If I enter the source of the file directly into the browser, I get a routing error: "No route matches http://0.0.0.0:3000/images/rails.png".

Any help?

Yours,

Joern


Check your environments' config file, ie. config/environments/production.rb. If there's a setting config.serve_static_assets = false , the problem you described will occur.

0

精彩评论

暂无评论...
验证码 换一张
取 消