module Undercarriage::Controllers::Restful::Actions::EditConcern

Edit restful action

Usage

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

Public Instance Methods

edit() click to toggle source

Edit 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 `@edit_resource` or `@example`
  #
  # def edit
  #   ...
  # end
end
# File lib/undercarriage/controllers/restful/actions/edit_concern.rb, line 41
def edit
  nested_resource_pre_build
  nested_resource_build
end

Protected Instance Methods

edit_resource_content() click to toggle source

Edit 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 edit_resource_content
  #   ...
  # end

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

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

Private Instance Methods

edit_resource() click to toggle source
# File lib/undercarriage/controllers/restful/actions/edit_concern.rb, line 87
def edit_resource
  @edit_resource ||= edit_resource_content
end