Method: JSONAPI::Authorization::DefaultPunditAuthorizer#include_has_one_resource

Defined in:
lib/jsonapi/authorization/default_pundit_authorizer.rb

#include_has_one_resource(source_record:, related_record:) ⇒ Object

Any request including ?include=another-resource

This will be called for each has_one relationship if the include goes deeper than one level until some authorization fails or the include directive has been travelled completely.

Parameters

  • source_record — The source relationship record, e.g. an Article in

    article.author check
    
  • related_record - The associated record to return

rubocop:disable Lint/UnusedMethodArgument



260
261
262
# File 'lib/jsonapi/authorization/default_pundit_authorizer.rb', line 260

def include_has_one_resource(source_record:, related_record:)
  ::Pundit.authorize(user, related_record, 'show?')
end