No commit activity in last 3 years
No release in over 3 years
Allows you to easily specify default values for attributes on new model objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Changes for this Fork¶ ↑

  • Ported to a Gem.

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', :address => proc { Address.new }

  default :last_name do |person|
    person.first_name
  end
end

The default value is only used if the attribute is not present in the attributes hash.

See active_record_defaults.rb for full documentation.

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