<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>7deeds &#187; routes</title>
	<atom:link href="http://blog.7deeds.com/tag/routes/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.7deeds.com</link>
	<description>Petros Amiridis - A humble programmer's seven noteworthy actions for the community</description>
	<lastBuildDate>Mon, 31 May 2010 12:09:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails: url vs path</title>
		<link>http://blog.7deeds.com/2009/09/21/rails-url-vs-path/</link>
		<comments>http://blog.7deeds.com/2009/09/21/rails-url-vs-path/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 22:30:44 +0000</pubDate>
		<dc:creator>Petros</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[ruby-on-rails]]></category>
		<category><![CDATA[self-note]]></category>

		<guid isPermaLink="false">http://blog.7deeds.com/?p=331</guid>
		<description><![CDATA[I was wondering why some people are using _path and why some use _url. For example, if you have a Post resource you can write the following in your view:
&#60;%= link_to 'List of posts', posts_path %&#62;
or the following in the controller:
redirect_to posts_url
Why should I use _url in the controller. I have used _path and it [...]]]></description>
			<content:encoded><![CDATA[<p>I was wondering why some people are using _path and why some use _url. For example, if you have a Post resource you can write the following in your view:</p>
<pre class="brush: ruby;">&lt;%= link_to 'List of posts', posts_path %&gt;</pre>
<p>or the following in the controller:</p>
<pre class="brush: ruby;">redirect_to posts_url</pre>
<p>Why should I use _url in the controller. I have used _path and it seems to work.</p>
<p>This is an explanation I found in a forum and I quote:</p>
<blockquote><p>
 *_path are for views because ahrefs are implicitly linked to the current URL. So it&#8217;d be a waste of bytes to repeat it over and over. In the controller, though, *_url is needed for redirect_to because the HTTP specification mandates that the Location: header in 3xx redirects is a complete URL.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.7deeds.com/2009/09/21/rails-url-vs-path/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
