* Move all associations related code from Serializer class to Associations module
* Introduce Reflection class hierarchy
* Introduce Association class
* Rid off Serializer#each_association
* Introduce Serializer#associations enumerator
Comparing as a JSON string vs. as the Hash that is convert to JSON
works around the different Hash representations.
This likely has to do with the introduction of
config.action_dispatch.perform_deep_munge in Rails 4.1
See Rails issue 13420
1) Failure:
ActiveModel::Serializer::Adapter::Json::HasManyTestTest#test_has_many_with_no_serializer
[active_model_serializers/test/adapter/json/has_many_test.rb:36]:
--- expected
+++ actual
@@ -1 +1 @@
-{:id=>42, :tags=>[{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}]}
+{:id=>42, :tags=>[{"attributes"=>{:id=>1, :name=>"#hash_tag"}}]}
2) Failure:
ActiveModel::Serializer::AssociationsTest#test_has_many_with_no_serializer
[active_model_serializers/test/serializers/associations_test.rb:74]:
--- expected
+++ actual
@@ -1 +1 @@
-[{"attributes"=>{"name"=>"#hashtagged"}}]
+[{"attributes"=>{:name=>"#hashtagged"}}]
Currently, doing `include: author.bio` would work correctly, but not for
has_many associations such as `include: author.roles`. This fixes it.
The problem was basically that we were not handling arrays for has_many linked,
as happens for ArraySerializers.
The options passed to the render are partitioned into adapter options
and serializer options. 'include' and 'root' are sent to the adapter,
not sure what options would go directly to serializer, but leaving this
in until I understand that better.