Ruby on Rails Wednesday, December 10, 2014

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.

On Wed, Dec 10, 2014 at 6:13 PM, tom <tomabroad@gmail.com> wrote:
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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMc1BLAJShiTn8Lziv6WsATm6R2jUZ8ivrhRnq3uS8VdKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAA2Dq%2BOZB97f%2BLcEK3xMZMj%3DxUiY7HiPqYUO4C2cOM0XbzRuOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment