aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/serializers/json_serialization_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move model definition to test/models for test order indenendencyAkira Matsuda2014-08-281-17/+0
|
* remove unnecessary require for json serialization test casesAditya Kapoor2014-06-241-1/+0
|
* Completely remove potential global state leaks in ActiveModel tests.Zuhao Wan2014-03-111-21/+27
| | | | ActiveModel tests can now be run in random order.
* fix actionview and activemodel test cases typosRajarshi Das2013-09-051-1/+1
|
* Dont' check for any order in hash since we aren't sorting it and this is ↵Guillermo Iguaran2013-08-181-11/+0
| | | | determinated only by the used interpreter
* Refactor serialization test for hash orderGuillermo Iguaran2013-08-181-7/+6
|
* Avoid Skip in test, have a unified test for orderGaurish Sharma2013-08-091-10/+7
|
* Add tests for ActiveModel::Serializers::JSON#as_json orderingGaurish Sharma2013-08-091-1/+10
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-1/+1
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Simplify keys order test for as_json in Active ModelCarlos Antonio da Silva2012-11-301-4/+1
|
* Add test for code change introduced in this commit f20032fCédric FABIANSKI2012-10-291-0/+9
|
* AM::Serializers::Xml depends on AM::NamingFrancesco Rodriguez2012-10-261-1/+0
|
* change AMS::JSON.include_root_in_json default value to falseFrancesco Rodriguez2012-06-061-50/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: * Update `include_root_in_json` default value to false for default value to false for `ActiveModel::Serializers::JSON`. * Remove unnecessary change to include_root_in_json option in wrap_parameters template. * Update `as_json` documentation. * Fix JSONSerialization tests. Problem: It's confusing that AM serializers behave differently from AR, even when AR objects include AM serializers module. class User < ActiveRecord::Base; end class Person include ActiveModel::Model include ActiveModel::AttributeMethods include ActiveModel::Serializers::JSON attr_accessor :name, :age def attributes instance_values end end user.as_json => {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true} # root is not included person.as_json => {"person"=>{"name"=>"Francesco", "age"=>22}} # root is included ActiveRecord::Base.include_root_in_json => false Person.include_root_in_json => true # different default values for include_root_in_json Proposal: Change the default value of AM serializers to false, update the misleading documentation and remove unnecessary change to false of include_root_in_json option with AR objects. class User < ActiveRecord::Base; end class Person include ActiveModel::Model include ActiveModel::AttributeMethods include ActiveModel::Serializers::JSON attr_accessor :name, :age def attributes instance_values end end user.as_json => {"id"=>1, "name"=>"Konata Izumi", "age"=>16, "awesome"=>true} # root is not included person.as_json => {"name"=>"Francesco", "age"=>22} # root is not included ActiveRecord::Base.include_root_in_json => false Person.include_root_in_json => false # same behaviour, more consistent Fixes #6578.
* replacing ordered hash to ruby hashprasath2012-02-081-2/+2
|
* Revert "Implement ArraySerializer and move old serialization API to a new ↵José Valim2011-11-301-0/+221
| | | | | | | | | | | | | namespace." This reverts commit 8896b4fdc8a543157cdf4dfc378607ebf6c10ab0. Conflicts: activemodel/lib/active_model.rb activemodel/lib/active_model/serializable.rb activemodel/lib/active_model/serializer.rb activemodel/test/cases/serializer_test.rb
* Implement ArraySerializer and move old serialization API to a new namespace.José Valim2011-11-231-219/+0
| | | | | | | | | | | | | The following constants were renamed: ActiveModel::Serialization => ActiveModel::Serializable ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON ActiveModel::Serializers::Xml => ActiveModel::Serializable::XML The main motivation for such a change is that `ActiveModel::Serializers::JSON` was not actually a serializer, but a module that when included allows the target to be serializable to JSON. With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
* Fixing `as_json` method for ActiveRecord models.Nicolás Hock Isaza2011-09-291-0/+10
| | | | | | | | | | | | | When you've got an AR Model and you override the `as_json` method, you should be able to add default options to the renderer, like this: class User < ActiveRecord::Base def as_json(options = {}) super(options.merge(:except => [:password_digest])) end end This was not possible before this commit. See the added test case.
* fixed a bug with the json serialization when the class setting is set to not ↵Matt Aimonetti2011-09-221-0/+10
| | | | include the root, but an instance is serialized with the root option passed as true
* Enable passing root: false to #to_jsonJoe Fiorini2011-07-011-1/+52
|
* Rename test directory to match code directoryJohn Firebaugh2011-04-061-0/+148
Hopefully "serializeration" is not an in joke that I missed.