diff options
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 10 | ||||
-rw-r--r-- | activemodel/test/cases/errors_test.rb | 10 |
2 files changed, 0 insertions, 20 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 01ca540d28..99f47f2cbe 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -167,16 +167,6 @@ module ActiveModel def as_json(options=nil) self end - - def encode_json(encoder) - errors = [] - each_pair do |key, value| - value = value.first if value.size == 1 - errors << "#{encoder.encode(key.to_s)}:#{encoder.encode(value, false)}" - end - - "{#{errors * ','}}" - end # Adds +message+ to the error messages on +attribute+, which will be returned on a call to # <tt>on(attribute)</tt> for the same attribute. More than one error can be added to the same diff --git a/activemodel/test/cases/errors_test.rb b/activemodel/test/cases/errors_test.rb index 1958ed112c..79b45bb298 100644 --- a/activemodel/test/cases/errors_test.rb +++ b/activemodel/test/cases/errors_test.rb @@ -61,15 +61,5 @@ class ErrorsTest < ActiveModel::TestCase assert_equal ["name can not be blank", "name can not be nil"], person.errors.to_a end - - test 'to_json should return valid json string' do - person = Person.new - person.errors.add(:name, "can not be blank") - person.errors.add(:name, "can not be nil") - - hash = ActiveSupport::OrderedHash[:name, ["can not be blank", "can not be nil"]] - - assert_equal person.errors.to_json, hash.to_json - end end |