Class: Pragma::Operation::Update

Inherits:
Base
  • Object
show all
Includes:
Defaults
Defined in:
lib/pragma/operation/update.rb

Overview

Finds the requested record, authorizes it, updates it accordingly to the parameters and responds with the decorated record.

Author:

  • Alessandro Desantis

Instance Method Summary collapse

Methods included from Defaults

included

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pragma/operation/update.rb', line 11

def call
  record = find_record
  contract = build_contract(record)

  validate! contract
  authorize! contract

  contract.save

  respond_with resource: decorate(record)
end