lib/muck-friends/models/friend.rb
# When enable_following is true this will setup a follower.  When enable_following is false
# the system only allows friends and so this becomes a friend request
When enable_following is true this will setup a follower.  When enable_following is false
the system only allows friends and so this becomes a friend request
When enable_following is true this will setup a follower . When enable_following is false the system only allows friends and so this becomes a friend request
def block_user(user, target)
          return false if user.blank? || target.blank?
          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
            friend.update_attribute(:status, MuckFriends::BLOCKED)
          else
            false
          end
        end
def block_user ( user , target ) return false if user . blank? || target . blank? 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 friend . update_attribute ( :status , MuckFriends :: BLOCKED ) else false end end
When enable_following is true this will setup a follower.
When enable_following is true this will setup a follower .
user
target