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:
@@ -34,7 +34,7 @@ class Budget < ApplicationRecord
|
|||||||
has_many :groups, dependent: :destroy
|
has_many :groups, dependent: :destroy
|
||||||
has_many :headings, through: :groups
|
has_many :headings, through: :groups
|
||||||
has_many :lines, through: :ballots, class_name: "Budget::Ballot::Line"
|
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
|
has_one :poll
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Community < ApplicationRecord
|
class Community < ApplicationRecord
|
||||||
has_one :proposal
|
has_one :proposal
|
||||||
has_one :investment, class_name: Budget::Investment
|
has_one :investment, class_name: "Budget::Investment"
|
||||||
has_many :topics
|
has_many :topics
|
||||||
|
|
||||||
def participants
|
def participants
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class MapLocation < ApplicationRecord
|
class MapLocation < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :proposal, touch: true
|
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
|
validates :longitude, :latitude, :zoom, presence: true, numericality: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Poll::Ballot < ApplicationRecord
|
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
|
validates :ballot_sheet_id, presence: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Poll::BallotSheet < ApplicationRecord
|
class Poll::BallotSheet < ApplicationRecord
|
||||||
belongs_to :poll
|
belongs_to :poll
|
||||||
belongs_to :officer_assignment
|
belongs_to :officer_assignment
|
||||||
has_many :ballots, class_name: Poll::Ballot
|
has_many :ballots, class_name: "Poll::Ballot"
|
||||||
|
|
||||||
validates :data, presence: true
|
validates :data, presence: true
|
||||||
validates :poll_id, presence: true
|
validates :poll_id, presence: true
|
||||||
|
|||||||
Reference in New Issue
Block a user