module ActsAsHtmlSanitized::ModelExtensions::ClassMethods

Public Instance Methods

acts_as_html_sanitized() click to toggle source
# File lib/acts_as_html_sanitized/model_extensions.rb, line 11
def acts_as_html_sanitized
  before_validation do |record|
    for column in record.class.content_columns
      if column.type == :string || column.type == :text
        unless record[column.name].nil?
          record[column.name] = Sanitize.clean(record[column.name])
        end
      end
    end
  end
end