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

@@ -34,7 +34,7 @@ class Budget < ApplicationRecord
has_many :groups, dependent: :destroy
has_many :headings, through: :groups
has_many :lines, through: :ballots, class_name: "Budget::Ballot::Line"
has_many :phases, class_name: Budget::Phase
has_many :phases, class_name: "Budget::Phase"
has_one :poll

View File

@@ -1,6 +1,6 @@
class Community < ApplicationRecord
has_one :proposal
has_one :investment, class_name: Budget::Investment
has_one :investment, class_name: "Budget::Investment"
has_many :topics
def participants

View File

@@ -1,7 +1,7 @@
class MapLocation < ApplicationRecord
belongs_to :proposal, touch: true
belongs_to :investment, class_name: Budget::Investment, touch: true
belongs_to :investment, class_name: "Budget::Investment", touch: true
validates :longitude, :latitude, :zoom, presence: true, numericality: true

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