fixes booth-poll relation

This commit is contained in:
Juanjo Bazán
2016-12-02 14:24:31 +01:00
parent cc27c3735c
commit 6419878741
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
class Poll < ActiveRecord::Base
has_many :booth_assigments
has_many :booths, through: :booth_assigments, class_name: "Poll::BoothAssignment"
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
has_many :booths, through: :booth_assignments
has_many :voters, through: :booths, class_name: "Poll::Voter"
has_many :officers, through: :booths, class_name: "Poll::Officer"
has_many :questions

View File

@@ -1,11 +1,11 @@
class Poll
class Booth < ActiveRecord::Base
has_many :booth_assigments
has_many :polls, through: :booth_assigments
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
has_many :polls, through: :booth_assignments
has_many :voters
has_many :officing_booths, dependent: :destroy
has_many :officers, through: :officing_booths
validates :name, presence: true
validates :name, presence: true, uniqueness: true
end
end