module Undercarriage::Controllers::Restful::Actions::ShowConcern

Show restful action

Usage

class ExamplesController < ApplicationController
  include Undercarriage::Controllers::RestfulConcern
end

Public Instance Methods

show() click to toggle source

Show action

Usage

class ExamplesController < ApplicationController
  include Undercarriage::Controllers::RestfulConcern

  ##
  # This method is only needed if you want to override the action entirely. Otherwise, it is not needed.
  # Database resources can be accessed as `@show_resource` or `@example`
  #
  # def show
  #   ...
  # end
end
# File lib/undercarriage/controllers/restful/actions/show_concern.rb, line 41
def show; end

Protected Instance Methods

show_resource_content() click to toggle source

Show restful action

Usage

class ExamplesController < ApplicationController
  include Undercarriage::Controllers::RestfulConcern

  ##
  # This method is only needed if you want to override the query entirely. Otherwise, it is not needed.
  # Database resources can be accessed as `@example`
  #
  # def show_resource_content
  #   ...
  # end

  ##
  # To add authorization through something like Pundit, the following could be used
  #
  # def show_resource_content
  #   super
  #
  #   authorize @example
  # end

  ##
  # The `resource_content` method can also be overwritten. Be careful with this because the `edit`,
  # `update`, and `destroy` actions will also use this method
  #
  # def resource_content
  #   ...
  # end
end
# File lib/undercarriage/controllers/restful/actions/show_concern.rb, line 78
def show_resource_content
  resource_content
end

Private Instance Methods

show_resource() click to toggle source
# File lib/undercarriage/controllers/restful/actions/show_concern.rb, line 84
def show_resource
  @show_resource ||= show_resource_content
end