I have followed tutorials and the dhh presentaion for creating my application but i get a bit stuck on creating and deleting the relationships between items. eg user - memberships - groups page 21 of the dhh presentation has this, though im not sure how to create this post from a link_to? #POST /memberships?group_id=1&user_id=2 with this delete action it appears that the membership id is already known #DELETE /memberships/3 would be great to see an example of this -- 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 -~----------~----~----~----~------~----~------~--~---
Jakob Skjerning
2006-Oct-04 05:55 UTC
Re: DHH presentation: how to actually create the membership
On Oct 4, 2006, at 4:28, Adam Madd wrote:> page 21 of the dhh presentation has this, though im not sure how to > create this post from a link_to? > > #POST /memberships?group_id=1&user_id=2In general it can be achieved using: link_to(''Foo'', {:controller => ''memberships'', :group_id => 1, :user_id => 2}, :method => ''post'') I believe there''s some shortcut when using the REST stuff, but I can''t recall how it''d look now. -- Jakob Skjerning - http://mentalized.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Adam Madd
2006-Oct-04 08:06 UTC
Re: DHH presentation: how to actually create the membership
thanks for the reply. That partly worked. 127.0.0.1 - - [04/Oct/2006:21:01:02 New Zealand Standard Time] "POST /memberships?user_id=1 HTTP/1.1" 302 117 http://localhost:3000/categories/1/products/2/parts -> /memberships?user_id=1 i am having to pass the group_id through session. As it is trimmed from the url, see the console output above. Checking this further i added a ''puts'' line to show the values of the user_id and group_id: puts params[:group_id] >> nil puts params[:user_id] >> 1 The shortcut version your refering to is the named route new_membership_path. I get an error when using this. -- 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 -~----------~----~----~----~------~----~------~--~---