Bit of a newbie question. I can't seem to get my application to pick up images that I have in a local folder ( public/stylesheets/images/XYZ/*.png). As a result my main page is rendered without some essential graphics.
In my HAML file, I have tags defined as follows: %img{:src => '/images/XYZ/scissor.png'}
This leads 开发者_StackOverflow中文版to calls like: Started GET "/images/dookum.in/scissor.png' for 127.0.0.1 ....
and error messages like: ActionController::RoutingError (No route matches "/images/dookum.in/scissor.png')
I don't know why this is happening. Do I need to define RAILS_ROOT? Or change routes.rb? If yes, then how?
Thanks for your help Abhinav
You may try to add following setting in your environment files
config.serve_static_assets = true
Either you write
= image_tag('scissor.png')
and this will look for the file /public/images/scissor.png
, or you should specify stylesheets/images/XYZ/...
Everything under /public
is served in development mode, if you want you rails process to serve everything under /public
in production-mode, you have to set the config.serve_static_assets
to true.
精彩评论