_path vs. _url

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.

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.

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.

Tim S. 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?

Thanks Fred.

On Jan 4, 7:44pm, SW Engineer [email protected] 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