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 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
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. On Dec 28, 2005, at 7:22 PM, Paul Jonathan Thompson wrote:> 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 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
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 Paul Jonathan Thompson wrote:> 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
Paul Jonathan Thompson
2005-Dec-29 02:51 UTC
Re: Images in Agile Web Development with Rails
Thanks David, it works now and thanks also for the article on regular expressions. That has cleared a lot of fog! Paul On 12/29/05, David Rupp <rails-T+GAArMh60A/u7dgPfZd+NBPR1lH4CV8@public.gmane.org> wrote:> > 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. > > On Dec 28, 2005, at 7:22 PM, Paul Jonathan Thompson wrote: > > 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 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Yeah, regular expressions can be pretty foggy. :-) Glad I could help, David On Dec 28, 2005, at 7:51 PM, Paul Jonathan Thompson wrote:> Thanks David, it works now and thanks also for the article on > regular expressions. That has cleared a lot of fog! > > Paul > > On 12/29/05, David Rupp <rails-T+GAArMh60A/u7dgPfZd+NBPR1lH4CV8@public.gmane.org> wrote: > 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. > > On Dec 28, 2005, at 7:22 PM, Paul Jonathan Thompson wrote: > >> 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 >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails