spyridon.vasileiadis-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2006-Dec-31 19:50 UTC
Rest. _url vs _path
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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe that _url generates things like " http://example.com/controller/action" and _path generates "/controller/action" Mark On 12/31/06, spyridon.vasileiadis-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org < spyridon.vasileiadis-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > > 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 > > > > >-- Mark Van Holstyn mvanholstyn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://lotswholetime.com --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
spyridon.vasileiadis-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2006-Dec-31 19:59 UTC
Re: Rest. _url vs _path
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? On Dec 31, 9:54 pm, "Mark Van Holstyn" <mvett...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I believe that _url generates things like "http://example.com/controller/action" and _path generates > "/controller/action" > > Mark > > On 12/31/06, spyridon.vasileia...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org < > > > > spyridon.vasileia...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > 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-- > Mark Van Holstyn > mvanhols...-Re5JQEeQqe80Tx58lXaADg@public.gmane.org://lotswholetime.com--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
tjstankus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-02 02:07 UTC
Re: Rest. _url vs _path
> 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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---