adds validations to officer_assignments

This commit is contained in:
Juanjo Bazán
2016-12-27 17:44:35 +01:00
parent 15b072a983
commit 2f918e8eef

View File

@@ -3,6 +3,10 @@ class Poll
belongs_to :officer
belongs_to :booth_assignment
validates :officer_id, presence: true
validates :booth_assignment_id, presence: true
validates :date, presence: true, uniqueness: { scope: [:officer_id, :booth_assignment_id] }
delegate :poll_id, :booth_id, to: :booth_assignment
end
end