friendship.befriender = current_user
friendship.befriendee = @friend
if current_user.friends_with?(@friend)
friendship.befriender = current_user
friendship.befriendee = @friend
if current_user.friends_with?(@friend)
elsif current_user.friendships.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_friends_per_hour
flash[:error] = t ".limit_exceeded"
elsif friendship.save
elsif current_user.friendships.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_friends_per_hour
flash[:error] = t ".limit_exceeded"
elsif friendship.save
Friendship.where(:befriender => current_user, :befriendee => @friend).delete_all
flash[:notice] = t ".success", :name => @friend.display_name
else
Friendship.where(:befriender => current_user, :befriendee => @friend).delete_all
flash[:notice] = t ".success", :name => @friend.display_name
else