From e500d15704644cbc1a104e161a5ed2b8fab11fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 8 Aug 2019 18:28:35 +0200 Subject: [PATCH] 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. --- app/models/budget/phase.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/models/budget/phase.rb b/app/models/budget/phase.rb index 5d28e65ab..56d125d1d 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -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