Module: Amistad::ActiveRecord::FriendshipModel
- Defined in:
- lib/amistad/active_record/friendship_model.rb
Defined Under Namespace
Modules: InstanceMethods
Class Method Summary collapse
Class Method Details
.included(receiver) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/amistad/active_record/friendship_model.rb', line 4 def self.included(receiver) receiver.class_exec do include InstanceMethods belongs_to :user belongs_to :friend, :class_name => "User", :foreign_key => "friend_id" belongs_to :blocker, :class_name => "User", :foreign_key => "blocker_id" validates_presence_of :user_id, :friend_id validates_uniqueness_of :friend_id, :scope => :user_id end end |