Home > nilify

nilify

Nilify is a project mainly written in Ruby, based on the MIT license.

ActiveRecord Plugin to set default values to nil

=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 (c) 2009 Tobias Schmidt, released under the MIT license

Previous:ccan