Module: RestingPug::Chains

Defined in:
lib/resting_pug/chains.rb

Overview

Describes chains of methods for actions. Each chain is an array of methods running one by one.

Used in:

Instance Method Summary collapse

Instance Method Details

#create_chainObject (protected)

Note:

Override this method to add or remove methods executed while creating a subject

Creates a chain of methods for creating a subject

Examples:

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a create chain adding logging to the end
  def create_chain
    super + [:log_creating_subject]
  end
end

Used in:

Use:


22
23
24
# File 'lib/resting_pug/chains.rb', line 22

def create_chain
  [:create_subject, :decide_what_to_render]
end

#destroy_chainObject (protected)

Note:

Override this method to add or remove methods executed while deleting a subject

Creates a chain of methods for deleting a subject

Examples:

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a destroy chain adding logging to the end
  def destroy_chain
    super + [:log_destroying_subject]
  end
end

Used in:

Use:


61
62
63
# File 'lib/resting_pug/chains.rb', line 61

def destroy_chain
  [:fetch_subject, :destroy_subject]
end

#index_chainObject (protected)

Note:

Override this method to add or remove methods executed while showing a list of subjects

Creates a chain of methods for showing a list of subjects

Examples:

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override an index chain adding logging to the end
  def index_chain
    super + [:log_indexing_subjects]
  end
end

Used in:

Use:


102
103
104
# File 'lib/resting_pug/chains.rb', line 102

def index_chain
  [:fetch_subjects, :filter_subjects, :sort_subjects, :paginate_subjects, :render_subjects]
end

#show_chainObject (protected)

Note:

Override this method to add or remove methods executed while showing a subject

Creates a chain of methods for showing a subject

Examples:

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override a show chain adding logging to the end
  def show_chain
    super + [:log_showing_subject]
  end
end

Used in:

Use:


80
81
82
# File 'lib/resting_pug/chains.rb', line 80

def show_chain
  [:fetch_subject, :render_subject]
end

#update_chainObject (protected)

Note:

Override this method to add or remove methods executed while updating a subject

Creates a chain of methods for updating a subject

Examples:

class BooksController < ApplicationController
  include RestingPug::Base

  private
  # Override an update chain adding logging to the end
  def update_chain
    super + [:log_updating_subject]
  end
end

Used in:

Use:


42
43
44
# File 'lib/resting_pug/chains.rb', line 42

def update_chain
  [:fetch_subject, :update_subject, :decide_what_to_render]
end