adds relations to officer/booth assignments
This commit is contained in:
@@ -4,6 +4,7 @@ class Poll
|
|||||||
belongs_to :poll
|
belongs_to :poll
|
||||||
|
|
||||||
has_many :officer_assignments, class_name: "Poll::OfficerAssignment", dependent: :destroy
|
has_many :officer_assignments, class_name: "Poll::OfficerAssignment", dependent: :destroy
|
||||||
|
has_many :recounts, class_name: "Poll::Recount", dependent: :destroy
|
||||||
has_many :officers, through: :officer_assignments
|
has_many :officers, through: :officer_assignments
|
||||||
has_many :voters
|
has_many :voters
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class Poll
|
|||||||
class OfficerAssignment < ActiveRecord::Base
|
class OfficerAssignment < ActiveRecord::Base
|
||||||
belongs_to :officer
|
belongs_to :officer
|
||||||
belongs_to :booth_assignment
|
belongs_to :booth_assignment
|
||||||
|
has_one :recount
|
||||||
|
|
||||||
validates :officer_id, presence: true
|
validates :officer_id, presence: true
|
||||||
validates :booth_assignment_id, presence: true
|
validates :booth_assignment_id, presence: true
|
||||||
|
|||||||
Reference in New Issue
Block a user