lib/graphql/groups/has_aggregates.rb in graphql-groups-0.2.2 vs lib/graphql/groups/has_aggregates.rb in graphql-groups-0.2.3
- old
+ new
@@ -13,11 +13,11 @@
resolve_method = "resolve_#{name}".to_sym
query_method = options[:query_method] || name
field = aggregate_field name, aggregate_type,
null: false,
- query_method: query_method,
+ query_method:,
resolver_method: resolve_method,
**options, &block
aggregate_type.add_fields(field.own_attributes)
define_method query_method do |scope:, **kwargs|
@@ -29,9 +29,10 @@
end
end
def aggregate_field(*args, **kwargs, &block)
field_defn = Schema::AggregateField.from_options(*args, owner: self, **kwargs, &block)
+ field_defn.ensure_loaded if Gem::Version.new(GraphQL::VERSION) >= Gem::Version.new('2.3')
add_field(field_defn)
field_defn
end
private