This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
jonathan (author)
Thu Sep 13 20:58:42 -0700 2007
| name | age | message | |
|---|---|---|---|
| |
CHANGELOG | ||
| |
MIT-LICENSE | Sat Oct 28 21:02:40 -0700 2006 | |
| |
README | ||
| |
Rakefile | Sat Oct 28 21:02:40 -0700 2006 | |
| |
init.rb | Sat Oct 28 21:02:40 -0700 2006 | |
| |
lib/ | ||
| |
test/ |
README
= Active Record Defaults If you find this plugin useful, please consider a donation to show your support! http://www.paypal.com/cgi-bin/webscr?cmd=_send-money Email address: jonathan.viney@gmail.com == Instructions Allow you to easily specify default values for attributes on new model objects. Eg: class Person < ActiveRecord::Base defaults :country => 'New Zealand', :type => 'Unknown' default :last_name do |person| person.first_name end end You can also define a defaults method like so: class Person < ActiveRecord::Base def defaults self.first_name = "Jonathan" end end The default value is only used if the attribute is not present in the attributes hash: p = Person.new p.country # "New Zealand" p = Person.new(:country => nil) p.country # nil == Installation script/plugin install http://svn.viney.net.nz/things/rails/plugins/active_record_defaults == Help Feel free to email with any problems, suggestions, bugs etc... jonathan dot viney @ gmail . com








