Rest. _url vs _path


#1

Hello people!

Can someone explain what the difference between the ._url and ._path
named routes generate by rest is?
http://cheat.errtheblog.com/b (actually down at the moment) mentions
the following (taken from peepcode.com, yay topfunky!)

“Each method also has a counterpart ending in _url that includes the
protocol,
domain, and port.”
which I dont quite get, I mean no matter wich ones I use (in dev mode)
produce the same links. could someone rephrase/explain that?

many thanks && happy new year!
Spyros


#2

yeah but like i said, in the end (ie browser) a complete link is
displayed. so does it make a difference to use path instead of url,
since path does get its prefix (domain+port) by rails anyway? can it be
that it makes a difference while in production rather than dev mode?


#3

I believe that _url generates things like "
http://example.com/controller/action" and _path generates
“/controller/action”

Mark

On 12/31/06, removed_email_address@domain.invalid <
removed_email_address@domain.invalid> wrote:

protocol,
domain, and port."
which I dont quite get, I mean no matter wich ones I use (in dev mode)
produce the same links. could someone rephrase/explain that?

many thanks && happy new year!
Spyros


Mark Van H.
removed_email_address@domain.invalid
http://lotswholetime.com


#4

yeah but like i said, in the end (ie browser) a complete link is
displayed. so does it make a difference to use path instead of url,
since path does get its prefix (domain+port) by rails anyway? can it be
that it makes a difference while in production rather than dev mode?

I don’t think production/dev mode makes any difference. But there are
cases where you’ll need one and not the other. There may be other
examples, but it makes a difference when you’re passing a named route
to the current_page? method. You’d want to use _path in that case; _url
won’t work. (It’s because of the way current_page? compares using
url_for and the request uri.)

-TJ