Images in Agile Web Development with Rails


I am working through Agile Web D. with Rails and I am at pg 69
second last paragraph says “put some images in the public/images
directory…” how do you code the link that is stored in the data
base I
have tried http:public/images/name .jpg with no avail I have tried the
qualified address http://home/../../../../name.jpg also with no luck.
should I code this?

Thank you,


The url would be images/filename.jpg, not public/images/filename.jpg. I
think that might be your problem.

Also, you might want to take a look at the file_column plugin. Details
are on the plugins page on the rails wiki.


In the ‘New’ and ‘Editing Product’ screens, fill in the ‘Image url:’
text field with ‘/images/your_image_name.jpg’. Then change the
regular expression in the ‘validates_format_of :image_url :with…’
directive (in app/models/product.rb) to be %r{.(gif|jpg|png)$}i
(leaving off the ^http:.+ stuff).

I’ve published some of the gory details behind this change at http://

Yeah, regular expressions can be pretty foggy. :slight_smile:

Glad I could help,

Thanks David, it works now and thanks also for the article on regular
expressions. That has cleared a lot of fog!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs