diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-14 11:58:35 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-14 14:30:40 -0700 |
commit | 3f63ac4e4dd22a452a37ad7a654cf5e4f4e66349 (patch) | |
tree | 63179c74db0ccd44be244849d5471311273d2407 /activerecord/lib | |
parent | 0f29c216074c5da6644feddb5184c4881c078b0d (diff) | |
download | rails-3f63ac4e4dd22a452a37ad7a654cf5e4f4e66349.tar.gz rails-3f63ac4e4dd22a452a37ad7a654cf5e4f4e66349.tar.bz2 rails-3f63ac4e4dd22a452a37ad7a654cf5e4f4e66349.zip |
Correctly determine if an attribute is uninitialized
In real usage, we give the builder a types hash with a default value of
`Type::Value.new`. This means we need to explicitly check for the key,
rather than the truthiness of the type to determine if it's a known but
uninitialized attribute
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_set/builder.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_set/builder.rb b/activerecord/lib/active_record/attribute_set/builder.rb index 3946e02d10..54e9cbb779 100644 --- a/activerecord/lib/active_record/attribute_set/builder.rb +++ b/activerecord/lib/active_record/attribute_set/builder.rb @@ -65,7 +65,7 @@ module ActiveRecord if values.key?(name) hash[name] = Attribute.from_database(name, values[name], type) - elsif type + elsif types.key?(name) hash[name] = Attribute.uninitialized(name, type) end end |