Implement description sanitization

This commit is contained in:
kikito
2015-07-31 16:10:32 +02:00
parent 824ce3c8fe
commit c1028f794c

View File

@@ -12,6 +12,8 @@ class Debate < ActiveRecord::Base
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
before_validation :sanitize_description
def likes
get_likes.size
end
@@ -32,4 +34,10 @@ class Debate < ActiveRecord::Base
editable? && author == user
end
end
protected
def sanitize_description
self.description = WYSIWYGSanitizer.new.sanitize(description)
end
end