RE: Rails urls & the AWD book

Bill,

I remember running into the same problem with the book. Here is an
errata from the web site … basically the validation is broken:

#896: The suggested image url is relative /images/sk_auto_small.jpg but
the validation requires a full url starting with http.

(Dave says: I’m going to tidy all that up in the next edition: it was a
change made at the suggestion of a reviewer, but in retrospect I regret
it)

http://books.pragprog.com/titles/rails/errata

-Steve


From: [email protected]

[mailto:[email protected]] On Behalf Of Bill W.
Sent: Sunday, February 19, 2006 2:44 PM
To: [email protected]
Subject: [Rails] Rails urls & the AWD book

Greetings!

I'm having a hard time understanding the way Rails handles urls.

I’m specifically having real trouble with the image_urls in the Depot
app in the Agile Web D. book.

If I enter "\image\file.png" in the Add Product page, the image

is displayed in the other views and Properties shows
http://localhost:3000/images/file.png
If I leave off the leading backslash and enter “image\file.png”
the image does not display and Properties shows
http://localhost:3000/admin/images/file.png when I look at it from the
admin_controller or http://localhost:3000/store/images/file.png when I
look at it from the store_controller.

In either case, the validation the book shows for image_url

really trips me up because it’s checking to see that the string begins
with “http:”. What’s up with that?

Also, when I'm supplying the location in the unit test I'm

having to use a string I really don’t understand. The string is:
“c:\instantrails\rails_apps\depot\public\images\rails.png”
Why do some of the '' characters have to be escaped and others
not? Or is that not what’s going on?

Could someone help?  At least point me to some docs on this

topic?

Thanks,
Bill