Files
nairobi/app/models/concerns/sanitizable.rb
Senén Rodero Rodríguez a68098eaed 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.
2019-04-17 17:40:56 +02:00

20 lines
407 B
Ruby

module Sanitizable
extend ActiveSupport::Concern
included do
before_validation :sanitize_description
before_validation :sanitize_tag_list
end
protected
def sanitize_description
self.description = WYSIWYGSanitizer.new.sanitize(description)
end
def sanitize_tag_list
self.tag_list = TagSanitizer.new.sanitize_tag_list(tag_list) if self.class.taggable?
end
end