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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F8451aa0650d328c31023a2d46117cfb?d=identicon&s=25 Paul Jonathan Thompson (Guest)
on 2005-12-29 03:22
(Received via mailing list)
Hi,

I am working through Agile Web Development 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
fully
qualified address http://home/../../../../name.jpg also with no luck.
How
should I code this?

Thank you,

Paul
8a456610e31c8feadc4cef71d9347cbd?d=identicon&s=25 Craig Ambrose (Guest)
on 2005-12-29 03: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.

Craig
Bfc3ae865ab5cb781b9d1d4b50ab132b?d=identicon&s=25 David Rupp (Guest)
on 2005-12-29 03: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://
www.ruppconsulting.com/?p=7.
F8451aa0650d328c31023a2d46117cfb?d=identicon&s=25 Paul Jonathan Thompson (Guest)
on 2005-12-29 03: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!

Paul
Bfc3ae865ab5cb781b9d1d4b50ab132b?d=identicon&s=25 David Rupp (Guest)
on 2005-12-29 04:26
(Received via mailing list)
Yeah, regular expressions can be pretty foggy. :-)

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