diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-06-08 19:25:56 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-06-08 19:37:51 -0700 |
commit | 6e73cf6bdf0ab3961f212735b4ac46f7e924fcd5 (patch) | |
tree | aa9b07d8dbfeb56121cf7ff660c3ec8cff72f542 /activerecord/test/cases | |
parent | 99cf77be270e71408a14f0c00472517adb5981b2 (diff) | |
download | rails-6e73cf6bdf0ab3961f212735b4ac46f7e924fcd5.tar.gz rails-6e73cf6bdf0ab3961f212735b4ac46f7e924fcd5.tar.bz2 rails-6e73cf6bdf0ab3961f212735b4ac46f7e924fcd5.zip |
Fix AR json encoding
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/json_serialization_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index 0ffbc9bf3b..54bc8e2343 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -170,18 +170,18 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase def test_should_allow_only_option_for_list_of_authors authors = [@david, @mary] - assert_equal %([{"name":"David"},{"name":"Mary"}]), authors.to_json(:only => :name) + assert_equal %([{"name":"David"},{"name":"Mary"}]), ActiveSupport::JSON.encode(authors, :only => :name) end def test_should_allow_except_option_for_list_of_authors authors = [@david, @mary] - assert_equal %([{"id":1},{"id":2}]), authors.to_json(:except => [:name, :author_address_id, :author_address_extra_id]) + assert_equal %([{"id":1},{"id":2}]), ActiveSupport::JSON.encode(authors, :except => [:name, :author_address_id, :author_address_extra_id]) end def test_should_allow_includes_for_list_of_authors authors = [@david, @mary] - json = authors.to_json( + json = ActiveSupport::JSON.encode(authors, :only => :name, :include => { :posts => { :only => :id } @@ -200,6 +200,6 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase 2 => @mary } - assert_equal %({"1":{"name":"David"}}), authors_hash.to_json(:only => [1, :name]) + assert_equal %({"1":{"name":"David"}}), ActiveSupport::JSON.encode(authors_hash, :only => [1, :name]) end end |