Method: ApiMaker::IndividualCommand#raise_model_not_found_or_no_access

Defined in:
lib/api_maker/individual_command.rb

#raise_model_not_found_or_no_accessObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/api_maker/individual_command.rb', line 38

def raise_model_not_found_or_no_access
  command_name = command
    .name
    .delete_prefix("Commands::")
    .gsub(/Command\Z/, "")

  model_name = collection.klass.name

  raise NotFoundOrNoAccessError, "Couldn't find or no access to #{model_name} #{primary_key} on the #{command_name} command"
end