Sav wrote:> My problem is I don''t know how to construct those pretty links in
my
> link_to and redirect_to paths...
Whenever you are looking into a routing issue, your first step should
be:
rake routes
run in your application top level and understand what this is telling
you.
> product_lines_path(:brand_id => params[:id])
> # returns: /product_lines?brand_id=4
> # desired: /brands/4/product_lines
brand_product_lines_path 1
or:
brand_product_lines_path :brand_id => 1
> link_to product_path(@product)
> # returns: /products/4
> # desired: /brands/1/product_lines/5/products/4
brand_product_line_product_path 1, 5, 4
or:
brand_product_line_product_path :brand_id => 1,
:product_line_id => 5, :product_id => 4
These URLs are pretty cumbersome. Have a look here for some advise on
nested resources:
http://weblog.jamisbuck.org/2007/2/5/nesting-resources
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---