pointcom / sanitize_before_save forked from danteregis/sanitize_before_save
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
MIT-LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
spec/ | ||
| |
tasks/ | ||
| |
test/ | ||
| |
uninstall.rb |
README
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

