On 28 August 2012 14:51, Jean-Sébastien D. <[email protected]> wrote: > Based on the following tutorial > http://stackoverflow.com/questions/5612736/how-to-implement-a-friendship-model-in-rails-3-for-a-social-networking-applicati. > I am wondering how should i create the action controllers. > > In my friendship tutorial i have the following actions > > def accept > end > def decline > end > def cancel > end > def delete > end > def index > end > def create > end > I can call create has follow <%= link_to "Add Friend", > friendships_path(:friend_id => customer), :method => :post %> but how > can call the following others accepts, decline, and cancel. > > Do i need to add the following in my route > > resources :friendships do > get 'cancel' > get 'accept' > get 'decline' > end > And call has follow: > > <%= link_to "Add Friend", friendships_path(:friend_id => customer), > :method => :post %> > > Because i get the following error > > Routing Error > No route matches {:action=>"cancel", :controller=>"friendships"}
If you run rake routes it will show you all the routes you have defined. Also consider what in get 'cancel' the 'get' means. Colin > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

