Remove unneded before validation callbacks
After globalize gem update there is no need to keep this monkey patch.
More information here [1]
[1] 3075c89b70
This commit is contained in:
committed by
voodoorai2000
parent
4068ef29ee
commit
da1c5fdb01
@@ -22,8 +22,6 @@ class Budget < ApplicationRecord
|
||||
|
||||
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :phase, inclusion: { in: Budget::Phase::PHASE_KINDS }
|
||||
validates :currency_symbol, presence: true
|
||||
|
||||
@@ -22,8 +22,6 @@ class Budget
|
||||
|
||||
has_many :headings, dependent: :destroy
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :budget_id, presence: true
|
||||
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
||||
|
||||
@@ -26,8 +26,6 @@ class Budget
|
||||
has_many :investments
|
||||
has_many :content_blocks
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
|
||||
validates_translation :name, presence: true
|
||||
validates :group_id, presence: true
|
||||
validates :price, presence: true
|
||||
|
||||
@@ -9,10 +9,6 @@ module Globalizable
|
||||
translations.reject(&:_destroy).map(&:locale)
|
||||
end
|
||||
|
||||
def assign_model_to_translations
|
||||
translations.each { |translation| translation.globalized_model = self }
|
||||
end
|
||||
|
||||
def description
|
||||
self.read_attribute(:description).try :html_safe
|
||||
end
|
||||
|
||||
@@ -18,7 +18,6 @@ class ProgressBar < ApplicationRecord
|
||||
}
|
||||
validates :percentage, presence: true, inclusion: RANGE, numericality: { only_integer: true }
|
||||
|
||||
before_validation :assign_model_to_translations
|
||||
validates_translation :title, presence: true, unless: :primary?
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user