Module | Loofah::ActiveRecordExtension |
In: |
lib/loofah/active_record.rb
|
Loofah can scrub ActiveRecord attributes in a before_validation callback:
# config/initializers/loofah.rb require 'loofah' # db/schema.rb create_table "posts" do |t| t.string "title" t.string "body" end # app/model/post.rb class Post < ActiveRecord::Base html_fragment :body, :scrub => :prune # scrubs 'body' in a before_validation end
Scrub an ActiveRecord attribute attribute as an HTML document using the method specified by scrubber_specification.
scrubber_specification must be an argument acceptable to Loofah::ScrubBehavior.scrub!, namely:
Scrub an ActiveRecord attribute attribute as an HTML fragment using the method specified by scrubber_specification.
scrubber_specification must be an argument acceptable to Loofah::ScrubBehavior.scrub!, namely: