On Jul 24, 5:26 pm, Jan Kadera <[email protected]> wrote:
> To Frederick:
> "What do you mean by  'there are no relative paths in rails' ?"
> As I understand the difference, there is some point in the computer
> directory tree, where is said I'm working, for example
> /home/myusername/RubyApps/rails/default
> now if I want to link something inside of that directory, you just type name
> of the file, because some kind of magic or more than human power will know
> it should first look there.
> On the other hand the absolute path is recognized by starting with the only
> root of the whole computer filesystem, like "/" or "C:\"
>
> ...so if I have to use "/" in the pseudo-relative path like this, then I
> guess I'm using absolute path from the relative point described above, which
> I absolutely don't get.

Almost - you're looking at it from the point of view of your computer
whereas you need to be looking it at from the point of view of  the
web browser & web server: / doesn't mean the root of your hard drive,
it means the root of your website, which for a rails app is
your_rails_app/public. Relative paths are relative to the page the
browser is currently sitting on, so if your browser is displaying
http://foo.com/blah then an image with path 'pics/logo.png' will
request http://foo.com/blah/pics/logo.png whereas '/pics/logo.png'
will request http://foo.com/pics/logo.png

Fred


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to