Module: LHS::Record::Find::ClassMethods

Defined in:
lib/lhs/concerns/record/find.rb

Instance Method Summary collapse

Instance Method Details

#find(*args) ⇒ Object

Find a single uniqe record



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lhs/concerns/record/find.rb', line 10

def find(*args)
  args, options = process_args(args)
  data =
    if args.is_a? Array
      find_in_parallel(args, options)
    elsif args.is_a? Hash
      find_with_parameters(args, options)
    else
      find_by_id(args, options)
    end
  return data if data.is_a?(Array) || !data._record
  data._record.new(data)
end