Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rails-api/active_model_serializers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3f49f51a88950189d2ef25a1826dbd7fdfe59a72
Choose a base ref
..
head repository: rails-api/active_model_serializers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 15318b7fd4a48ad26d607ab8a6c592f34c189bfd
Choose a head ref
Showing with 0 additions and 6 deletions.
  1. +0 −6 lib/active_model/serializer.rb
6 changes: 0 additions & 6 deletions lib/active_model/serializer.rb
Original file line number Diff line number Diff line change
@@ -212,12 +212,6 @@ def each_association(&block)
options.except(:serializer).merge(serializer_from_options(association_options))
)
rescue ActiveModel::Serializer::ArraySerializer::NoSerializerError
# 1. Failure to serialize an element in a collection, e.g. [ {hi: "Steve" } ] will fail
# with NoMethodError when the ArraySerializer finds no serializer for the hash { hi: "Steve" },
# and tries to call new on that nil.
# 2. Convert association_value to hash using implicit as_json
# 3. Set as virtual value (serializer is nil)
# 4. Consider warning when this happens
virtual_value = association_value
virtual_value = virtual_value.as_json if virtual_value.respond_to?(:as_json)
association_options[:association_options][:virtual_value] = virtual_value