diff options
author | Thilo Utke <thilo@upstre.am> | 2010-11-28 14:36:40 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-12-01 11:43:37 +0100 |
commit | 7148b933c4865a5140187d7ed792fd6df9b860a4 (patch) | |
tree | 56f77db136192f65eb4e3a1417d8b989e56cfe37 /activemodel/test/cases/errors_test.rb | |
parent | 1ec126dd37b52ecf7c0c24a842fc87836d8f2e9b (diff) | |
download | rails-7148b933c4865a5140187d7ed792fd6df9b860a4.tar.gz rails-7148b933c4865a5140187d7ed792fd6df9b860a4.tar.bz2 rails-7148b933c4865a5140187d7ed792fd6df9b860a4.zip |
ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json serialization to properly handle multiple errors per attribute [#5615 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/test/cases/errors_test.rb')
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 79b45bb298..27821c333b 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -62,4 +62,9 @@ class ErrorsTest < ActiveModel::TestCase end + test 'to_hash should return an ordered hash' do + person = Person.new + person.errors.add(:name, "can not be blank") + assert_instance_of ActiveSupport::OrderedHash, person.errors.to_hash + end end |