Class: Pragma::Operation::Update
- Inherits:
-
Base
- Object
- Base
- Pragma::Operation::Update
- 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.
Instance Method Summary collapse
Methods included from Defaults
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pragma/operation/update.rb', line 11 def call context.record = find_record context.contract = build_contract(context.record) validate! context.contract context.contract context.contract.save context.record.save! respond_with resource: decorate(context.record), status: :ok end |