Permalink
Browse files

prepopulate attribute hash with nil attributes

  • Loading branch information...
1 parent 5b24160 commit b25168654b0af981dcd40cef8b2f7909e06089f6 @maccman maccman committed Aug 30, 2010
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/supermodel/base.rb
@@ -126,6 +126,7 @@ def known_attributes
def initialize(attributes = {})
@new_record = true
@attributes = {}.with_indifferent_access
+ @attributes.merge!(known_attributes.inject({}) {|h, n| h[n] = nil; h })
@changed_attributes = {}
load(attributes)
end

0 comments on commit b251686

Please sign in to comment.