diff options
Diffstat (limited to 'activerecord/lib/active_record/attribute_set.rb')
-rw-r--r-- | activerecord/lib/active_record/attribute_set.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_set.rb b/activerecord/lib/active_record/attribute_set.rb index ed2500a675..99fc9b6ac6 100644 --- a/activerecord/lib/active_record/attribute_set.rb +++ b/activerecord/lib/active_record/attribute_set.rb @@ -1,11 +1,15 @@ module ActiveRecord class AttributeSet # :nodoc: - delegate :[], :[]=, :fetch, :include?, :keys, :each_with_object, to: :attributes + delegate :[], :[]=, :fetch, :include?, :keys, to: :attributes def initialize(attributes) @attributes = attributes end + def values_before_type_cast + attributes.each_with_object({}) { |(k, v), h| h[k] = v.value_before_type_cast } + end + def to_hash attributes.each_with_object({}) { |(k, v), h| h[k] = v.value } end |