Module: Amistad::FriendshipModel::ClassMethods

Defined in:
lib/amistad/friendship_model.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_friendshipObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/amistad/friendship_model.rb', line 9

def acts_as_friendship
  belongs_to :user
  belongs_to :friend, :class_name => "User", :foreign_key => "friend_id"
  
  validates_presence_of :user_id, :friend_id
  
  class_eval <<-EOV
    include Amistad::FriendshipModel::InstanceMethods
  EOV
end