Use Translation classes consistently

We're moving the code for the phases translation class to the same place
in the code the other translation classes are: right after including the
Globalizable module.
This commit is contained in:
Javi Martín
2019-08-08 18:28:35 +02:00
parent 59478ef461
commit e500d15704

View File

@@ -9,6 +9,17 @@ class Budget
translates :summary, touch: true
translates :description, touch: true
include Globalizable
class Translation
before_validation :sanitize_description
private
def sanitize_description
self.description = WYSIWYGSanitizer.new.sanitize(description)
end
end
include Sanitizable
belongs_to :budget
@@ -99,15 +110,5 @@ class Budget
def in_phase_or_later?(phase)
PHASE_KINDS.index(kind) >= PHASE_KINDS.index(phase)
end
class Translation < Globalize::ActiveRecord::Translation
before_validation :sanitize_description
private
def sanitize_description
self.description = WYSIWYGSanitizer.new.sanitize(description)
end
end
end
end