ActionController::RoutingError (No route matches [GET] "/image.jpg"):

I am using rails 3.1.3.

Inside config/ application -> config.assets.enabled = true
Inside development.rb -> config.assets.compress = false
Inside production.rb -> config.serve_static_assets = false;
config.assets.compile = false

I have images placed in assets/images. If i do localhost:3000/assets/
image I get the image in the browser, but
unfortunately, on the browser i am unable to view the images,

I am getting following errors in development mode. Haven’t tested yet
in production.

Started GET “/winecountry_part2.jpg” for 127.0.0.1 at 2011-11-26
12:56:40 -0800

ActionController::RoutingError (No route matches [GET] “/
winecountry_part2.jpg”):

Rendered /Users/jayparteek/.rvm/gems/ruby-1.9.2-head@default/gems/
actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/
routing_error.erb within rescues/layout (0.6ms)

On Sat, Nov 26, 2011 at 16:29, J.P [email protected] wrote:

I have images placed in assets/images. If i do localhost:3000/assets/
image I get the image in the browser, but
unfortunately, on the browser i am unable to view the images,

Please clarify what you mean by “on the browser I am unable”. You
just said that you can, with localhost:3000/assets/image (assuming by
“image” you mean winecountry_part2.jpg).

I am getting following errors in development mode. Haven’t tested yet
in production.

Started GET “/winecountry_part2.jpg” for 127.0.0.1 at 2011-11-26
12:56:40 -0800

ActionController::RoutingError (No route matches [GET] “/
winecountry_part2.jpg”):

That is correct behavior. The image assets are not stored directly
under public, but under public/assets. That’s why the path
localhost:3000/assets/winecountry_part2.jpg will work – this is going
directly to public/assets/winecountry_part2.jpg. By contrast, if you
try localhost:3000/winecountry_part2.jpg, there is no such file, so
the server looks at your routes, finds none, and complains.

-Dave


LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern
languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote
work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com
(excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble!
(Aronson)