Sha256: c390569a15850f43a5b8bbf13f8f4ca9af7d6f82ad1874b7d01cb009306f4bcb

Contents?: true

Size: 592 Bytes

Versions: 7

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true
module Pragma
  module Operation
    # Finds the requested record, authorizes it and decorates it.
    #
    # @author Alessandro Desantis
    class Show < Pragma::Operation::Base
      include Pragma::Operation::Defaults

      def call
        context.record = find_record
        authorize! context.record

        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

7 entries across 7 versions & 1 rubygems

Version Path
pragma-1.2.4 lib/pragma/operation/show.rb
pragma-1.2.3 lib/pragma/operation/show.rb
pragma-1.2.1 lib/pragma/operation/show.rb
pragma-1.2.0 lib/pragma/operation/show.rb
pragma-1.1.2 lib/pragma/operation/show.rb
pragma-1.1.1 lib/pragma/operation/show.rb
pragma-1.1.0 lib/pragma/operation/show.rb