lib/graphql-pundit.rb in graphql-pundit-0.3.0 vs lib/graphql-pundit.rb in graphql-pundit-0.4.0

- old
+ new

@@ -6,12 +6,13 @@ require 'graphql' # Define `authorize` and `authorize!` helpers module GraphQL def self.assign_authorize(raise_unauthorized) - lambda do |defn, query = nil, record = nil| + lambda do |defn, query = nil, policy: nil, record: nil| opts = {record: record, query: query || defn.name, + policy: policy, raise: raise_unauthorized} if query.respond_to?(:call) opts = {proc: query, raise: raise_unauthorized} end Define::InstanceDefinable::AssignMetadataKey.new(:authorize).