New to rails


#1

Hi,
I’m 8+ hours reading and working through the book “Agile Web
Development”.
My brain is now mush :slight_smile:
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


#2

On Jun 5, 2006, at 03:38 PM, Dark A. wrote:

I’m 8+ hours reading and working through the book “Agile Web
Development”. My brain is now mush :slight_smile:
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. :slight_smile:

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


#3

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. :slight_smile:

Stuart