404 images and assets in Rails 3.2

For folks that have come from a traditional web dev background they may think that putting an image “example.jpg” into the /assets/images folder might be accessed via a url mirroring that path e.g. “www.domain.com/assets/images/example.jpg”.  I spent 10 minutes noobishly confused until I realised that you don’t specify the /images/ part of the path in the url.  So the above example would be served up on “http://www.domain.com/assets/example.jpg” even though the image is in the images folder.  I’m using Rails 3.2.

When debugging this the server is (obviously) returning a 404 for the image file and if you try to browse to the image directly rails returns a route not defined error.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: