Class: Pragma::Operation::Create
- Inherits:
-
Base
- Object
- Base
- Pragma::Operation::Create
- Includes:
- Defaults
- Defined in:
- lib/pragma/operation/create.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/create.rb', line 11 def call context.record = build_record context.contract = build_contract(context.record) validate! context.contract context.contract context.contract.save context.record.save! respond_with status: :created, resource: decorate(context.record) end |