Rails - Allows you to specify models that will always sanitize content before saving it to the database.
License
danteregis/sanitize_before_save
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Sanitize Before Save ==================== 'Sanitize Before Save' is a Ruby on Rails plugin. It Allows you to specify models that will always sanitize content before saving it to the database. Example ======= Just put the following line ('sanitize_before_save') in your model : class Person < ActiveRecord::Base sanitize_before_save end and automaticaly all your model data stored in database as a String value will be sanitized before they will be saved (or updated). @person = Person.create(:name => %(Mathieu Fosse<script type="text/javascript">alert('Hello !');</script>)) @person.name == "Mathieu Fosse" Optionnaly you can add an except option to disabled sanitize process in some fields like that : class Person < ActiveRecord::Base sanitize_before_save :except => :name end With this option, all Person model fields will be sanitized before they will be saved except for 'name' field. Copyright (c) 2008 Dante S. Regis, released under the MIT license
About
Rails - Allows you to specify models that will always sanitize content before saving it to the database.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published