Module: LHS::Record::FindBy::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#find_by(params = {}, options = nil) ⇒ Object

Fetch some record by parameters



12
13
14
15
16
# File 'lib/lhs/concerns/record/find_by.rb', line 12

def find_by(params = {}, options = nil)
  _find_by(params, trace!(options))
rescue LHC::NotFound
  nil
end

#find_by!(params = {}, options = nil) ⇒ Object

Raise if no record was found



19
20
21
# File 'lib/lhs/concerns/record/find_by.rb', line 19

def find_by!(params = {}, options = nil)
  _find_by(params, trace!(options))
end