grobie / nilify
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
nilify /
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
lib/ | ||
| |
spec/ |
README.rdoc
Nilify
Nilify is an ActiveRecord Plugin that allows you to easily convert default values to nil. Only attributes you specify will be checked and converted.
Default values are:
String: "" Numeric: 0 Time: 1970-01-01 00:00:00
Installation
script/plugin install git://github.com/grobie/nilify.git
Example
class User < ActiveRecord::Base
nilify :name, :salary, :birthday
end
user = User.create(:name => "", :salary => 0, :birthday => Time.parse("1970-01-01"))
user.name # => nil
user.salary # => nil
user.birthday # => nil
License
Copyright © 2009 Tobias Schmidt, released under the MIT license

