Use strings for class_name
As mentioned in the Rails console: DEPRECATION WARNING: Passing a class to the `class_name` is deprecated and will raise an ArgumentError in Rails 5.2. It eagerloads more classes than necessary and potentially creates circular dependencies. Please pass the class name as a string.
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, class_name: "Poll::BallotSheet"
|
||||
|
||||
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, class_name: "Poll::Ballot"
|
||||
|
||||
validates :data, presence: true
|
||||
validates :poll_id, presence: true
|
||||
|
||||
Reference in New Issue
Block a user