# Path methods. Where they came from?

**URL:** <https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782>\
**Category:** Rails\
**Created:** [September 29, 2008, 8:06pm UTC](https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782 "2008-09-29T20:06:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oferar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/67e7ee/32.png) [@oferar](https://www.ruby-forum.com/u/oferar)\
**Post date:** [September 29, 2008, 8:06pm UTC](https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782/1 "2008-09-29T20:06:31Z")

</div>

Hello, I’m playing with a depot sample application from (Agile …) and  
notice the following on a view:

\<%= link\_to ‘Edit’, edit\_product\_path(@product) %\> |  
\<%= link\_to ‘Back’, products\_path %\>

I added a new model/view/controller, and in the view displayed all the  
methods, and notice that I have xxx\_product\_methods included.

Where they come from? How can I add people\_path for example if I added a  
people controller?

Thanks very much.  
regards;  
fernando.

---

<div class="post-metadata">

**Author:** ![oferar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/67e7ee/32.png) [@oferar](https://www.ruby-forum.com/u/oferar)\
**Post date:** [September 29, 2008, 8:42pm UTC](https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782/2 "2008-09-29T20:42:24Z")

</div>

Fernando R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> Where they come from? How can I add people\_path for example if I added a  
> people controller?

They come from the map.resources lines in config/routes.rb. See  
[http://api.rubyonrails.org/classes/ActionController/Resources.html#M000696](http://api.rubyonrails.org/classes/ActionController/Resources.html#M000696)  
for more information.

to add such paths for a ‘people’ controller, add a line like

map.resources :people

to config/routes.rb

Cheers – Eric

---

<div class="post-metadata">

**Author:** ![oferar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/67e7ee/32.png) [@oferar](https://www.ruby-forum.com/u/oferar)\
**Post date:** [August 3, 2012, 9:14am UTC](https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782/3 "2012-08-03T09:14:58Z")

</div>

On Monday, September 29, 2008 11:28:53 AM UTC-7, Eric S. wrote:

> They come from the map.resources lines in config/routes.rb. See  
> [http://api.rubyonrails.org/classes/ActionController/Resources.html#M000696](http://api.rubyonrails.org/classes/ActionController/Resources.html#M000696)  
> for more information.

This link is now invalid, I’m 90% sure the correct location is currently  
in  
[http://api.rubyonrails.org/](http://api.rubyonrails.org/) under  
ActionDispatch::Routing::Mapper::Resources  
(sorry I can’t seem to get the direct link).

– Cedric

---

<div class="post-metadata">

**Author:** ![oferar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/67e7ee/32.png) [@oferar](https://www.ruby-forum.com/u/oferar)\
**Post date:** [September 30, 2008, 6:48pm UTC](https://www.ruby-forum.com/t/path-methods-where-they-came-from/149782/4 "2008-09-30T18:48:11Z")

</div>

Thanks very much Eric!  
fernando.
