Remove unnecessary class names in relations
Just like we do in the Budget module, and in some places in the Poll and Legislation modules, we don't need to specify the class name when the name of the relation matches the name of a class in the same module.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Poll::Ballot < ApplicationRecord
|
||||
belongs_to :ballot_sheet, class_name: "Poll::BallotSheet"
|
||||
belongs_to :ballot_sheet
|
||||
|
||||
validates :ballot_sheet_id, presence: true
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Poll::BallotSheet < ApplicationRecord
|
||||
belongs_to :poll
|
||||
belongs_to :officer_assignment
|
||||
has_many :ballots, class_name: "Poll::Ballot"
|
||||
has_many :ballots
|
||||
|
||||
validates :data, presence: true
|
||||
validates :poll_id, presence: true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Poll
|
||||
class Booth < ApplicationRecord
|
||||
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
|
||||
has_many :booth_assignments
|
||||
has_many :polls, through: :booth_assignments
|
||||
has_many :shifts
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ class Poll
|
||||
|
||||
before_destroy :destroy_poll_shifts, only: :destroy
|
||||
|
||||
has_many :officer_assignments, class_name: "Poll::OfficerAssignment", dependent: :destroy
|
||||
has_many :officer_assignments, dependent: :destroy
|
||||
has_many :officers, through: :officer_assignments
|
||||
has_many :voters
|
||||
has_many :partial_results
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class Poll
|
||||
class Officer < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_many :officer_assignments, class_name: "Poll::OfficerAssignment"
|
||||
has_many :shifts, class_name: "Poll::Shift"
|
||||
has_many :officer_assignments
|
||||
has_many :shifts
|
||||
has_many :failed_census_calls, foreign_key: :poll_officer_id
|
||||
|
||||
validates :user_id, presence: true, uniqueness: true
|
||||
|
||||
@@ -15,7 +15,7 @@ class Poll::Question < ApplicationRecord
|
||||
has_many :answers, class_name: "Poll::Answer"
|
||||
has_many :question_answers, -> { order "given_order asc" }, class_name: "Poll::Question::Answer", dependent: :destroy
|
||||
has_many :partial_results
|
||||
has_many :pair_answers, class_name: "Poll::PairAnswer"
|
||||
has_many :pair_answers
|
||||
has_one :votation_type, as: :questionable
|
||||
belongs_to :proposal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user