title: What is the "_path" method in ruby on rails?
body: <p>I'm learning RoR, and I'm getting very confused by the "_path" method as it's used in Controllers and Routes. To be more specific, I'm referring to the many different calls that take the syntax "(something)_path". So far as I know, they all seem to either encode or manipulate a URL or link. I'm having a hard time mastering the use of this type of method because I can't figure out what it's core functionality is supposed to be.</p>
  
  <p>For example, I could use the following code to redirect an old URL structure to a page of listed Tweet instances in my config/routes.rb file:</p>
  
  <pre><code>get '/all' =&gt; 'tweets#index', as: 'all_tweets'
  </code></pre>
  
  <p>Only now can I use the following in an .erb file. Notice the "_path" code at the end of the line.</p>
  
  <pre><code>&lt;%= link_to "All Tweets", all_tweets_path %&gt;
  </code></pre>
  
  <p>I could also use the following code to create a link to an edit page (and another action) in a different .erb file:</p>
  
  <pre><code>&lt;p&gt;&lt;%= link_to tweet.user.name, edit_tweet_path(@tweet) %&gt;&lt;/p&gt;
  </code></pre>
  
  <hr>
  
  <p>I've tried reading through my study materials as well as the RoR documentation, but I always end up more lost than when I began. Does anybody know the low-level definition of this "_path" method?</p>