Sha256: e37f3b7e6745dfa22dbfd9ee4cbbe8359a37601186cf4426ddd248a172436355
Contents?: true
Size: 652 Bytes
Versions: 13
Compression:
Stored size: 652 Bytes
Contents
# frozen_string_literal: true module Maquina module Show extend ActiveSupport::Concern included do def show(&block) @resource ||= begin scope = resource_class # TODO: Implement filtering by organization # scope = scope.where(organization) # TODO: Implement policy authorization (ActionPolicy) scope = yield(scope) if block.present? scope.find_by!(find_by_param => params[:id]) end respond_to do |format| format.html format.json { render json: @resource } end end alias_method :show!, :show end end end
Version data entries
13 entries across 13 versions & 1 rubygems