ActiveRecord Defaults
Allow you to easily specify default values for attributes on new model objects. Eg:
1 class Person 2 defaults :country => 'New Zealand', :type => 'Unknown' 3 4 default :last_name do |person| 5 person.first_name 6 end 7 end
The default value is only used if the attribute is not present in the attributes hash:
1 p = Person.new 2 p.country # "New Zealand" 3 4 p = Person.new(:country => nil) 5 p.country # nil
- Repository Path: http://svn.viney.net.nz/things/rails/plugins/active_record_defaults/
Tags
Currently tagged with:
You need to Login to tag this item.