In the "Ruby on Rails tutorial" website: http://railstutorial.org/chapters/filling-in-the-layout#sec:rails_routes, section 5.2.2: Rails routes, it was mentioned that: match ''/about'', :to => ''pages#about'' Creates the following "named routes" for use in the controllers and views: about_path => ''/about'' about_url => ''http://localhost:3000/about'' After that, in section 5.2.3: Named routes: "#" in: <%= link_to "About", ''#'' %> Was replaced by: <%= link_to "About", about_path %> From this thing, why did I use "about_path" here and NOT "about_url"? Are they differeny then? So, does "about_path" denote the controller''s "action"? Thanks. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tuesday, January 4, 2011 2:36:51 PM UTC-5, Ruby-Forum.com User wrote:> > about_path => ''/about'' > about_url => ''http://localhost:3000/about'' > > From this thing, why did I use "about_path" here and NOT "about_url"? > Are they differeny then? >As you seem to have already discovered, the _url helper contain the domain, while the _path helpers do not. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tim Shaffer wrote in post #972300:> On Tuesday, January 4, 2011 2:36:51 PM UTC-5, Ruby-Forum.com User wrote: >> >> about_path => ''/about'' >> about_url => ''http://localhost:3000/about'' >> >> From this thing, why did I use "about_path" here and NOT "about_url"? >> Are they differeny then? >> > As you seem to have already discovered, the _url helper contain the > domain, > while the _path helpers do not.Thanks Tim. So, it is right that _path denotes that action? -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
In this case, how do we read: match ''/about'', :to => ''pages#about'' I mean, what does the preceding statement say? Where is the URL here? Thanks. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 4, 7:44 pm, SW Engineer <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> In this case, how do we read: > > match ''/about'', :to => ''pages#about'' > > I mean, what does the preceding statement say? Where is the URL here? >The host and protocol bit are are about allowing the browser to talk to the right url - once the request has made it to your server, only the path matters (unless you''ve got some account as subdomain stuff going on) A lot of the time in your app you only need the _path helpers, because you''re just linking between pages in your app (although it wouldn''t hurt to use the _url helpers). Sometimes you need a full url (eg for putting links in an email) and so those helpers are there too. Fred> Thanks. > > -- > Posted viahttp://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Fred. -- Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.