From b86579c40fd08dca07f46e121a781bac84b24bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Wed, 13 Feb 2019 17:51:19 +0100 Subject: [PATCH] Avoid crash when adding new translations Paranoia is activated on translation classes by reflection, this is making Rails to load translation classes before to execute migration that adds the new column. With this extra check Rails will not execute this code until translation table has this column created. --- app/models/concerns/globalizable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/globalizable.rb b/app/models/concerns/globalizable.rb index 7c961061c..df054caaf 100644 --- a/app/models/concerns/globalizable.rb +++ b/app/models/concerns/globalizable.rb @@ -17,7 +17,7 @@ module Globalizable self.read_attribute(:description).try :html_safe end - if self.paranoid? + if self.paranoid? && translation_class.attribute_names.include?("hidden_at") translation_class.send :acts_as_paranoid, column: :hidden_at end end