@@ -56,7 +56,7 @@ For each object type, you can assign a required action for Ruby objects of that
56
56
# app/graphql/types/base_object.rb
57
57
class Types ::BaseObject < GraphQL ::Schema ::Object
58
58
# Add the CanCan integration:
59
- include GraphQL ::Pro ::CanCan ::ObjectIntegration
59
+ include GraphQL ::Pro ::CanCanIntegration ::ObjectIntegration
60
60
# By default, require `can :read, ...`
61
61
can_can_action(:read )
62
62
# Or, to require no permissions by default:
@@ -140,14 +140,14 @@ module Types::BaseInterface
140
140
end
141
141
```
142
142
143
- Then, you can add ` can_can_ability :` options to your fields:
143
+ Then, you can add ` can_can_action :` options to your fields:
144
144
145
145
``` ruby
146
146
class Types ::JobPosting < Types ::BaseObject
147
147
# Only allow `can :review_applications, JobPosting` users
148
148
# to see who has applied
149
149
field :applicants , [Types ::User ], null: true ,
150
- can_can_ability : :review_applicants
150
+ can_can_action : :review_applicants
151
151
end
152
152
```
153
153
@@ -161,7 +161,7 @@ Similar to field-level checks, you can require certain permissions to _use_ cert
161
161
class Types ::BaseArgument < GraphQL ::Schema ::Argument
162
162
# Include the integration and default to no permissions required
163
163
include GraphQL ::Pro ::CanCanIntegration ::ArgumentIntegration
164
- can_can_ability nil
164
+ can_can_action nil
165
165
end
166
166
```
167
167
@@ -178,13 +178,13 @@ class Types::BaseInputObject < GraphQL::Schema::InputObject
178
178
end
179
179
```
180
180
181
- Now, arguments accept a ` can_can_ability :` option, for example:
181
+ Now, arguments accept a ` can_can_action :` option, for example:
182
182
183
183
``` ruby
184
184
class Types ::Company < Types ::BaseObject
185
185
field :employees , Types ::Employee .connection_type, null: true do
186
186
# Only admins can filter employees by email:
187
- argument :email , String , required: false , can_can_ability : :admin
187
+ argument :email , String , required: false , can_can_action : :admin
188
188
end
189
189
end
190
190
```
0 commit comments