Method: JsonApiClient::Query::Builder#find

Defined in:
lib/json_api_client/query/builder.rb

#find(args = {}) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/json_api_client/query/builder.rb', line 93

def find(args = {})
  if klass.raise_on_blank_find_param && args.blank?
    raise Errors::NotFound, 'blank .find param'
  end

  case args
  when Hash
    scope = where(args)
  else
    scope = _new_scope( primary_key: args )
  end

  scope._fetch
end