Path methods. Where they came from?

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.

Fernando R. [email protected] 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
for more information.

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

map.resources :people

to config/routes.rb

Cheers – Eric

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
for more information.

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

– Cedric

Thanks very much Eric!
fernando.