Merge branch 'master' of bitbucket.org:jamkazam/jam-web

This commit is contained in:
Seth Call 2012-10-25 07:13:04 -05:00
commit 2cefa2c669
1 changed files with 15 additions and 13 deletions

View File

@ -48,21 +48,23 @@ class ApiUsersController < ApplicationController
end
def friend_request_update
@friend_request = FriendRequest.find(params[:id])
@friend_request.accepted = params[:accepted]
@friend_request.save
ActiveRecord::Base.transaction do
@friend_request = FriendRequest.find(params[:id])
@friend_request.accepted = params[:accepted]
@friend_request.save
# create both records for this friendship
if @friend_request.accepted?
@friendship = Friendship.new()
@friendship.user_id = @friend_request.user_id
@friendship.friend_id = @friend_request.friend_id
@friendship.save
# create both records for this friendship
if @friend_request.accepted?
@friendship = Friendship.new()
@friendship.user_id = @friend_request.user_id
@friendship.friend_id = @friend_request.friend_id
@friendship.save
@friendship = Friendship.new()
@friendship.user_id = @friend_request.friend_id
@friendship.friend_id = @friend_request.user_id
@friendship.save
@friendship = Friendship.new()
@friendship.user_id = @friend_request.friend_id
@friendship.friend_id = @friend_request.user_id
@friendship.save
end
end
respond_with @friend_request, responder: ApiResponder