diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 5abd5cb4f..d4ef41137 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -14,7 +14,7 @@ class Milestone < ActiveRecord::Base validates :milestoneable, presence: true validates :publication_date, presence: true - before_validation :assign_milestone_to_translations + before_validation :assign_model_to_translations validates_translation :description, presence: true, unless: -> { status_id.present? } scope :order_by_publication_date, -> { order(publication_date: :asc, created_at: :asc) } @@ -25,9 +25,4 @@ class Milestone < ActiveRecord::Base 80 end - private - - def assign_milestone_to_translations - translations.each { |translation| translation.globalized_model = self } - end end diff --git a/app/models/progress_bar.rb b/app/models/progress_bar.rb index 7a7973723..2f494196e 100644 --- a/app/models/progress_bar.rb +++ b/app/models/progress_bar.rb @@ -17,12 +17,7 @@ class ProgressBar < ActiveRecord::Base } validates :percentage, presence: true, inclusion: RANGE, numericality: { only_integer: true } - before_validation :assign_progress_bar_to_translations + before_validation :assign_model_to_translations validates_translation :title, presence: true, unless: :primary? - private - - def assign_progress_bar_to_translations - translations.each { |translation| translation.globalized_model = self } - end end