Module: TinyRecord::ClassMethods

Defined in:
lib/tiny/record.rb

Instance Method Summary collapse

Instance Method Details

#fetch(id, with: nil) ⇒ Object



12
13
14
# File 'lib/tiny/record.rb', line 12

def fetch(id, with: nil)
  _get_records(_primary_lookup(id), with).take!
end

#fetch_by(tiny_columns = {}) ⇒ Object



16
17
18
19
# File 'lib/tiny/record.rb', line 16

def fetch_by(tiny_columns = {})
  with = tiny_columns.delete(:with)
  _get_records(tiny_columns, with).take
end

#fetch_where(*args) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/tiny/record.rb', line 21

def fetch_where(*args)
  if args[0].is_a?(Hash)
    _fetch_from_hash(args)
  else
    _fetch_from_string(args)
  end
end

#tiny_columns(*args) ⇒ Object



8
9
10
# File 'lib/tiny/record.rb', line 8

def tiny_columns(*args)
  @default_tiny_columns = *args
end