Module: NCore::Update
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ncore/methods/update.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#update(attribs = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/ncore/methods/update.rb', line 23 def update(attribs={}) params = parse_request_params(attribs, json_root: json_root).reverse_merge credentials: api_creds parsed, @api_creds = request(:put, resource_path, params) load(data: params[json_root]) if parsed[:errors].any? load(parsed) errors.empty? ? self : false end |
#update!(params = {}) ⇒ Object
31 32 33 |
# File 'lib/ncore/methods/update.rb', line 31 def update!(params={}) update(params) || raise(self.class.module_parent::RecordInvalid, self) end |