Sha256: 1c130dba97cb19cacff832816b29a5b4aee8582bab8a68f5691310e1f35f5b13
Contents?: true
Size: 772 Bytes
Versions: 4
Compression:
Stored size: 772 Bytes
Contents
# frozen_string_literal: true module Maquina module Update extend ActiveSupport::Concern included do def update(&block) @resource ||= begin scope = resource_class # scope = scope.where(organization) # TODO: Implement filtering by organization resource = scope.find_by!(find_by_param => params[:id]) authorize! resource, with: policy_class if policy_class.present? resource end saved = @resource.update(resource_secure_params) status = saved ? :accepted : :unprocessable_entity response.status = status set_flash_message(status) dual_action_response(@resource, &block) end alias_method :update!, :update end end end
Version data entries
4 entries across 4 versions & 1 rubygems