http://pastie.caboo.se/81829
That's my proposed solution. Thanks, Pratik On 7/24/07, Ben Munat <[EMAIL PROTECTED]> wrote: > > ara.t.howard wrote: > > > > On Jul 24, 2007, at 11:15 AM, Pratik wrote: > > > >> Anyways, I'm off this thread unless we see some patches. That makes > >> arguing a lot easier :-) > > > > --- vendor/rails/activerecord/lib/active_record/base.rb.org > > 2007-07-24 11:37:07.000000000 -0600 > > +++ vendor/rails/activerecord/lib/active_record/base.rb 2007-07-24 > > 11:40:32.000000000 -0600 > > @@ -1502,10 +1502,14 @@ > > @attributes = attributes_from_column_definition > > @new_record = true > > ensure_proper_type > > - self.attributes = attributes unless attributes.nil? > > + self.attributes = (attributes || > > {}).stringify_keys.reverse_merge!(defaults.stringify_keys) > > yield self if block_given? > > end > > + def defaults > > + Hash.new > > + end > > + > > # A model instance's primary key is always available as model.id > > # whether you name it the default 'id' or set it to something > > else. > > def id > > > > +1 > > Ben > > PS: however, not sure what rev you're diffing against but in head there's > another line between the > self.attributes and the yield: > > self.class.send(:scope, :create).each { |att,value| self.send("#{att}=", > value) } if > self.class.send(:scoped?, :create) > > > > > -- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---