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:
Javi Martín
2019-04-29 11:24:18 +02:00
parent e445e14d65
commit 234a5108a4
5 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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