Forum: Ruby on Rails Images in Agile Web Development with Rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Paul Jonathan T. (Guest)
on 2005-12-29 04:22
(Received via mailing list)

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,

Craig A. (Guest)
on 2005-12-29 04:38
(Received via mailing list)
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.

David R. (Guest)
on 2005-12-29 04:38
(Received via mailing list)
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://
Paul Jonathan T. (Guest)
on 2005-12-29 04:53
(Received via mailing list)
Thanks David, it works now and thanks also for the article on regular
expressions. That has cleared a lot of fog!

David R. (Guest)
on 2005-12-29 05:26
(Received via mailing list)
Yeah, regular expressions can be pretty foggy. :-)

Glad I could help,
This topic is locked and can not be replied to.