Sha256: 93a8148a906c565a0bc044db2d7cfc5409f61909f55e165ae37146f89999cf64

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

module ActiveManageable
  module Methods
    module Show
      extend ActiveSupport::Concern

      included do
        include ActiveManageable::Methods::Auxiliary::Includes
        include ActiveManageable::Methods::Auxiliary::Select
      end

      def show(id:, options: {})
        initialize_state(options: options)

        @target = action_scope
        includes(@options[:includes])
        select(@options[:select])

        yield if block_given?

        @target = find_object_for_show(id: id)
        authorize(record: @target)

        @target
      end

      private

      def find_object_for_show(id:)
        @target.find(id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_manageable-0.2.0 lib/active_manageable/methods/show.rb