diff options
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index c6535082d3..5cd8f77f0d 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -78,6 +78,11 @@ module ActiveModel @messages = ActiveSupport::OrderedHash.new end + def initialize_dup(other) + @messages = other.messages.dup + super + end + # Clear the messages def clear messages.clear @@ -118,7 +123,7 @@ module ActiveModel # p.errors[:name] = "must be set" # p.errors[:name] # => ['must be set'] def []=(attribute, error) - self[attribute.to_sym] << error + self[attribute] << error end # Iterates through each error key, value pair in the error messages hash. |