class Mutations::PromoteEmployee < Mutations::BaseMutation def ready?(**args) # argsはmutationの引数 if !context[:current_user].admin? raise GraphQL::ExecutionError, "Only admins can run this mutation" else true end end def resolver(**args) # mutation実行 end end authorized? mutationにはauthorized?メソッドも用意されています。実はこのメソッドはready?メソッドとほとんど同じ動きをします。上のready?をauthorized?に書き換えても同様に動作します。唯一の違いはargumentsをロードするかどうかで