We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e06027d + a03f81d commit 8bf6364Copy full SHA for 8bf6364
guides/fields/resolvers.md
@@ -42,16 +42,16 @@ end
42
43
```ruby
44
# Generate a field which returns a filtered, sorted list of items
45
-def self.items_field(name, override_options)
+def self.items_field(name, override_options, &block)
46
# Prepare options
47
default_field_options = { type: [Types::Item], null: false }
48
field_options = default_field_options.merge(override_options)
49
# Create the field
50
- field(name, field_options) do
+ field(name, **field_options) do
51
argument :order_by, Types::ItemOrder, required: false
52
argument :category, Types::ItemCategory, required: false
53
# Allow an override block to add more arguments
54
- yield self if block_given?
+ instance_eval(&block) if block_given?
55
end
56
57
0 commit comments