lib/muck-friends/models/friend.rb
# Stop friendship with another user.  This will turn the other user into a follower
Stop friendship with another user.  This will turn the other user into a follower
Stop friendship with another user . This will turn the other user into a follower
def revert_to_follower(user, target)
          return false if user.blank? || target.blank?
          transaction do
            friend = self.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id})
            friend.destroy if friend
            friend = self.find(:first, :conditions => {:inviter_id => target.id, :invited_id => user.id})
            if friend
              return friend.update_attribute(:status, MuckFriends::FOLLOWING)
            else
              return false
            end
          end
        end
def revert_to_follower ( user , target ) return false if user . blank? || target . blank? transaction do friend = self . find ( :first , :conditions => { :inviter_id => user . id , :invited_id => target . id } ) friend . destroy if friend friend = self . find ( :first , :conditions => { :inviter_id => target . id , :invited_id => user . id } ) if friend return friend . update_attribute ( :status , MuckFriends :: FOLLOWING ) else return false end end end
Stop friendship with another user.
Stop friendship with another user .
user
target