Sha256: aa341fb9c403d0b0c992af060c39975b567ab0d8b2b3fd7f75806fcc0af152e6
Contents?: true
Size: 578 Bytes
Versions: 3
Compression:
Stored size: 578 Bytes
Contents
module LoveMonster class Love < ActiveRecord::Base default_scope { order('created_at DESC') } belongs_to :person_to, :class_name => Person, :foreign_key => "to_user_id" belongs_to :person_from, :class_name => Person, :foreign_key => "from_user_id" has_many :likes validates :from_user_id, :to_user_id, :reason, :presence => true validate :ensure_to_and_from_are_distinct def ensure_to_and_from_are_distinct errors.add(:to_user_id, "You love yourself enough already. Go love someone else!") if from_user_id == to_user_id end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
love_monster-0.0.3 | app/models/love_monster/love.rb |
love_monster-0.0.2 | app/models/love_monster/love.rb |
love_monster-0.0.1 | app/models/love_monster/love.rb |