--- Revision None +++ Revision 313866316631 @@ -0,0 +1,18 @@ +# /lib/couchrest/core/model.rb line 526 + +# usage: +# set_default :random => lambda { return rand(99) }, :random2 => lambda { return rand(99) }, :test => true, :str => 'string' + +private + +def apply_defaults + if self.class.default + self.class.default.each do |k,v| + if v.class == Proc + self[k.to_s] = v.call + else + self[k.to_s] = Marshal.load(Marshal.dump(v)) + end + end + end +end