Fix sanitization for translatable description attribute

Move method from sanitizable to globalizable concern because
globalize_accessors were overiding sanitizable method and was never
called. Another solution to this could be to load sanitizable
always after globalizable concern.

Old method implementation was not working well with globalize_accessors,
it was returning nil always.
This commit is contained in:
Senén Rodero Rodríguez
2019-01-04 14:03:49 +01:00
committed by Julian Herrero
parent 638c80760f
commit a68098eaed
2 changed files with 4 additions and 4 deletions

View File

@@ -12,6 +12,10 @@ module Globalizable
def assign_model_to_translations def assign_model_to_translations
translations.each { |translation| translation.globalized_model = self } translations.each { |translation| translation.globalized_model = self }
end end
def description
self.read_attribute(:description).try :html_safe
end
end end
class_methods do class_methods do

View File

@@ -6,10 +6,6 @@ module Sanitizable
before_validation :sanitize_tag_list before_validation :sanitize_tag_list
end end
def description
super.try :html_safe
end
protected protected
def sanitize_description def sanitize_description