I am trying to create a friendship system. There is a post at
Which seem great but the create action doesn't work. How can it work here what I have
Controller #Send a friendship request def create Friendships.request(@customer, @friend) end
Model # Record a pending friend request. def self.request(customer, friend) unless customer == friend or Friendship.exists?(customer, friend) transaction do create(:customer => customer, :friend => friend, :status => 'pending') create(:customer => friend, :friend => customer, :status => 'requested') end end end
Here how I call it in my view and i think this is where the issue is <%= link_to "Request friendship with #{customer.first_name}", { :controller => "friendships", :action => "create", :id => customer.id }, :confirm => "Send friend request to #{customer.incomplete_name}?" %> <% end %>
Now the tutorial is old an i am wondering if the way i am calling it his the proper way. Thanks in advance