aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/attribute_set.rb2
-rw-r--r--activerecord/lib/active_record/attribute_set/builder.rb6
2 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/attribute_set.rb b/activerecord/lib/active_record/attribute_set.rb
index fdce68ce45..0c9793d470 100644
--- a/activerecord/lib/active_record/attribute_set.rb
+++ b/activerecord/lib/active_record/attribute_set.rb
@@ -24,7 +24,7 @@ module ActiveRecord
end
def keys
- attributes.initialized_keys
+ attributes.each_key.select { |name| self[name].initialized? }
end
def fetch_value(name)
diff --git a/activerecord/lib/active_record/attribute_set/builder.rb b/activerecord/lib/active_record/attribute_set/builder.rb
index 3a76f5262d..0f3c285a80 100644
--- a/activerecord/lib/active_record/attribute_set/builder.rb
+++ b/activerecord/lib/active_record/attribute_set/builder.rb
@@ -20,7 +20,7 @@ module ActiveRecord
end
class LazyAttributeHash # :nodoc:
- delegate :select, :transform_values, to: :materialize
+ delegate :select, :transform_values, :each_key, to: :materialize
def initialize(types, values, additional_types)
@types = types
@@ -45,10 +45,6 @@ module ActiveRecord
delegate_hash[key] = value
end
- def initialized_keys
- delegate_hash.keys | values.keys
- end
-
def initialize_dup(_)
@delegate_hash = delegate_hash.transform_values(&:dup)
super