Sha256: 5703a57082ab599e6e17f3dbaf444f610c46f6b51fb406c07a23ff535dee516a

Contents?: true

Size: 978 Bytes

Versions: 2

Compression:

Stored size: 978 Bytes

Contents

Sanitize-Rails - sanitize .. on Rails.
======================================

Installation
------------

Gemfile:

    gem 'sanitize-rails', :require => 'sanitize/rails'

Configuration
-------------

config/initializers/sanitizer.rb:

    Sanitize::Rails.configure(
      :elements    => [ ... ],
      :attribiutes => { ... },
      ...
    )

Usage
-----

app/models/foo.rb:

    sanitizes :field
    sanitizes :some_other_field,  :on => :create
    sanitizes :yet_another_field, :on => :save

ActionView `sanitize` helper is overriden to use
the Sanitize gem - transparently.

Testing
-------

Only Test::Unit for now - please write matchers
and send a pull request :-)

test/test\_helper:

    Sanitize::Rails::TestHelpers.setup(self,
      :invalid => 'some <a>string',
      :valid   => 'some <a>string</a>'
    )

your test:

    assert_sanitizes(Model, :field, :some_other_field)

Compatibility
-------------

Tested with Rails 3.0.x under Ruby 1.8 and 1.9.

Have fun.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sanitize-rails-0.6.1 README.md
sanitize-rails-0.6.0 README.md