Sha256: a38939e8a89001b6eacba0d8754cc4e386f685690d77cadcd16528a5193db8fb
Contents?: true
Size: 820 Bytes
Versions: 3
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true module Pragma module Operation # Finds the requested record, authorizes it, updates it accordingly to the parameters and # responds with the decorated record. # # @author Alessandro Desantis class Update < Pragma::Operation::Base include Pragma::Operation::Defaults def call context.record = find_record context.contract = build_contract(context.record) validate! context.contract authorize! context.contract context.contract.save context.record.save! respond_with resource: decorate(context.record) end protected # Finds the requested record. # # @return [Object] def find_record self.class.model_klass.find(params[:id]) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pragma-1.2.4 | lib/pragma/operation/update.rb |
pragma-1.2.3 | lib/pragma/operation/update.rb |
pragma-1.2.1 | lib/pragma/operation/update.rb |