I have my images stored in /rubyprograms/search/public/urlimages. I checked through my terminal to make sure that path is there and that all of the images are inside it. I link to the images, for example, at this path: /rubyprograms/search/public/urlimages/2173513720.jpg but my app cannot seem to find the image. For example, this is an error in my logs:
Started GET "/rubyprograms/search/public/urlimages/2173486240.jpg" for 127.0.0.1 at Thu Jul 07 21:34:23 -0700 2011
ActionController::RoutingError (No route matches "/rubyprograms/search/public/urlimages/2173486240.jpg"):
However I know the images are there at that route. Why is this happening?
If your app is in
/rubyprograms/search, thepublic/directory will be used as the root directory for all non-Rails requests.Because of this, the correct path to the images would be
/urlimages/2173486240.jpg.Rails has a handy helper for images, called
image_tag, which essentially creates image tags for you. The usage is:Please note that this will create the entire html tag, and assume that you have your images in
public/images/.