Forum: Ruby on Rails New to 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.
620c12639078ea2dde8a3b50ccee4c05?d=identicon&s=25 Dark Ambient (Guest)
on 2006-06-05 21:42
(Received via mailing list)
Hi,
I'm 8+ hours reading and working through the book "Agile Web
Development".
My brain is now mush :)
I have some php experience but that about the extent of my programming
experience.

Anyway, I do have a question - for those who know the book or those who
don't -

The product table has a column for an image link ..i.e.
/images/something.gif
As part of the exercise validation was added in to the admin area for
this
field requiring a HTTP:// to precede the path to the actual graphic.
For the life of me I can't figure out what is the correct path.  Depot
is
the project / head directory name.
I have tried a variety of things including
http://depot/public/images/x.gifnone of which seems to find the image.

Can anyone give me a clue as to what the correct path would be within
the
rails file structure.  Do I need to drop the http ?

TIA
Stuart
7c4087d053eb02d099a17d91ba5e33b5?d=identicon&s=25 Brian Hughes (Guest)
on 2006-06-05 22:21
(Received via mailing list)
On Jun 5, 2006, at 03:38 PM, Dark Ambient wrote:
> I'm 8+ hours reading and working through the book "Agile Web
> Development".  My brain is now mush :)
> I have some php experience but that about the extent of my
> programming experience.

Welcome! I can somewhat empathize with your "mush" feeling. Rails is
a whole lot to try and take in. :)

> Anyway, I do have a question - for those who know the book or those
> who don't -

Your question is actually relevant for far more than the depot
application in the AWDR book.

> Can anyone give me a clue as to what the correct path would be
> within the rails file structure.  Do I need to drop the http ?

When building a URL reference to a static object in the Rails app's
public folder, you have to remember to drop the public/ from the
path. Also, you would only add the depot/ to the path if you had
specifically configured your Rails app to behave like a sub-
directory. Otherwise, Rails apps always assume they are running at
the top-level, with respect to the URL path.

So, if you are running the depot app on your localhost at port 3000,
the URL to the x.gif image would look like:

   http://localhost:3000/images/x.gif

This is what you would use when running in development. If you plan
to push this app into production, you'll probably be using a
different host name and port for your app...

-Brian
620c12639078ea2dde8a3b50ccee4c05?d=identicon&s=25 Dark Ambient (Guest)
on 2006-06-05 23:27
(Received via mailing list)
Brian,
Thanks for the help.  Worked like a charm.  Yes, Rails is a lot to take
in.
That book doesn't take long and then it's straight into a commerce /
shopping cart project.  I like that guerilla type of teaching.  :)

Stuart
This topic is locked and can not be replied to.