diaspora/app/models/block.rb
Dan Hansen 16e76886d9 wip
2011-11-03 12:31:24 -07:00

15 lines
No EOL
375 B
Ruby

class Block < ActiveRecord::Base
belongs_to :person
belongs_to :user
validates :user_id, :presence => true
validates :person_id, :presence => true, :uniqueness => { :scope => :user_id }
validate :not_blocking_yourself
def not_blocking_yourself
if self.user.person.id == self.person_id
errors[:person_id] << "stop blocking yourself!"
end
end
end