Tabnav with nested ressources

3 views
Skip to first unread message

jawosis

unread,
Mar 24, 2008, 2:11:57 PM3/24/08
to SeeSaw's Rails Widgets Users
Hi,

I would like to use tabnav with nested ressources and do not know how
to make it work.
For example: To show photos of a product I would like to include a tab
linking to "/products/1/photos"

Can anyone help me?

Paolo Donà

unread,
Mar 25, 2008, 4:00:41 AM3/25/08
to rails-...@googlegroups.com
The easiest way to do it is something like:

add_tab do |t|
  t.named "photos"
  t.links_to :controller => 'photos', :action => 'index', :product_id => 1
end

otherwise you can use the hash_for_ version of your named route, something like:

add_tab do |t|
  t.named "photos"
  t.links_to hash_for_product_photos(@product)
end

the exact syntax depends on which rails version you're using and how you configured your resources (prefixes and so on..)
Paolo 
--
Paolo Dona'
SeeSaw | Intuitive web stuff
http://www.seesaw.it
paolo...@seesaw.it
personal http://paolodona.blogspot.com
Reply all
Reply to author
Forward
0 new messages