der_tom
(der_tom)
1
hi
i want to accomplish this:
forms/:id
forms/:id/list (action list)
forms/:id/card/:x (action showcard)
resources :forms do
get ‘list’, :action => ‘list’ #<< ok
get ‘card/:x’ , :action=> ‘showcard’ #, :as => ‘card’ <<crash no method defined…
end
and how would my link_to path look like? im going in circles. thx
pedrofsteim
(Pedro Fernandes Steimbruch)
2
Hi,
Some questions came up to my mind when looking at your routes.
- Do you really need a list action? Doesn’t index action fill your needs?
- Card seems to be another entitity. If It is true it would be better to use nested routes.
Using nested routes is easy:
resources :forms do
resources :cards, only: [:show] # if you need just show action
end
Checkout the docs for nested resources and here you can look for how to use link_to and nested routes
I’m sorry if I went in the wrong direction.