Module: NCore::Find::ClassMethods

Defined in:
lib/ncore/methods/find.rb

Instance Method Summary collapse

Instance Method Details

#find(id, params = {}) ⇒ Object

Raises:

  • (module_parent::RecordNotFound)


6
7
8
9
10
# File 'lib/ncore/methods/find.rb', line 6

def find(id, params={})
  raise(module_parent::RecordNotFound, "Cannot find id=nil") if id.blank?
  o = new({id: id})
  o.reload(params)
end

#retrieve(id, params = {}) ⇒ Object



12
13
14
15
16
# File 'lib/ncore/methods/find.rb', line 12

def retrieve(id, params={})
  find id, params
rescue module_parent::RecordNotFound
  nil
end