Module: Resourcery::ControllerExtensions::Filters

Defined in:
lib/resourcery/controller_extensions.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/resourcery/controller_extensions.rb', line 4

def self.included(base)
  base.before_filter(only: :index) do
    self.collection_ivar = collection
  end

  base.before_filter(only: [:show, :edit, :update, :destroy]) do
    self.resource_ivar = resource
  end

  base.before_filter(only: [:new, :create]) do
    self.resource_ivar = new_resource
  end
end