raw1z / amistad

Adds friendships management into a rails application
http://github.com/raw1z/amistad
MIT License
185 stars 71 forks source link

Create Friendship Through User Model View #19

Closed jinscoe-zz closed 12 years ago

jinscoe-zz commented 12 years ago

I've just gotten started integrating amistad - loving the features and have it all working in the CLI.

I'm attempting to create buttons on user show pages to add a friend however I'm not sure what the form_for would look like.

Currently I have something like

<%= form_for current_user.friend_with @user do |f| %>
<div><%= f.hidden_field :@user.id %></div>
<div><%= f.submit "Invite Friend", :class=> "btn primary" %></div>
<% end %>

This clearly doesn't work, but it's the idea of what I'm trying to do - I want an "Invite Friend" button on a user page that triggers the create method in my FriendshipsController.

Thanks for any help!