danteregis / sanitize_before_save
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
Dante S. Regis (author)
Mon Dec 15 12:48:58 -0800 2008
commit 66b7164dfaff3b0cb24ddef7e599b431c20e9ac3
tree 4a79b814a6d2b2c6fccbc2b60725f1dae5d51772
parent 34f1e67fc07644668ba1eaba733bc2c6b1d845dd parent f698d42b0e018d70b4385f1886fa0ccc5d02ec2b
tree 4a79b814a6d2b2c6fccbc2b60725f1dae5d51772
parent 34f1e67fc07644668ba1eaba733bc2c6b1d845dd parent f698d42b0e018d70b4385f1886fa0ccc5d02ec2b
| 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

