add relation validates
This commit is contained in:
parent
855eab3113
commit
9406ac6681
|
@ -6,6 +6,12 @@ class Relation < ActiveRecord::Base
|
||||||
|
|
||||||
validates :role, inclusion: { in: ROLES }
|
validates :role, inclusion: { in: ROLES }
|
||||||
|
|
||||||
|
validates :target,
|
||||||
|
presence: true
|
||||||
|
|
||||||
|
validates :actor,
|
||||||
|
presence: true
|
||||||
|
|
||||||
# validate { errors.add(:actor, :taken) if Relation.where(actor_type: self.actor_type, actor_id: self.actor_id).present? }
|
# validate { errors.add(:actor, :taken) if Relation.where(actor_type: self.actor_type, actor_id: self.actor_id).present? }
|
||||||
before_validation :add_default_role
|
before_validation :add_default_role
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue