lib/jsonapionify/api/resource/definitions/relationships.rb in jsonapionify-0.10.2 vs lib/jsonapionify/api/resource/definitions/relationships.rb in jsonapionify-0.11.0

- old
+ new

@@ -23,17 +23,12 @@ end def define_relationship_counter(rel_name, name, include: true) attribute name.to_sym, types.Integer, "The number of #{rel_name}.", write: false do |_, instance, context| rel = context.resource.class.relationship(rel_name) - blank_fields = context.fields.map { |k, _| [k, {}] }.to_h rel_context = rel.new( request: context.request, - context_overrides: { - owner: instance, - fields: blank_fields, - params: {} - } + context_overrides: { owner: instance, fields: {}, params: {} } ).exec { |c| c } count = rel_context.collection.uniq.count case count when Hash count.values.reduce(:+)