Method: NCore::Update::ClassMethods#update

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

#update(id, attribs) ⇒ Object

always returns a new object; check .errors? or .valid? to see how it went

Raises:

  • (module_parent::RecordNotFound)


15
16
17
18
19
20
# File 'lib/ncore/methods/update.rb', line 15

def update(id, attribs)
  raise(module_parent::RecordNotFound, "Cannot update id=nil") if id.blank?
  obj = new(id: id)
  obj.update attribs
  obj
end