Module: ActionController::Base::IdentityMap::ClassMethods

Included in:
ActionController::Base
Defined in:
lib/identity_map/action_controller/dispatcher.rb

Instance Method Summary collapse

Instance Method Details

#dont_use_identity_map(*args) ⇒ Object

Puts around filter which is disable identity map usage for actions.

dont_use_identity_map *args is shorthand for around_filter :without_identity_map, *args

Typically you would call it if undesired behaviour were introduced by identity_map

class ThingsController
  dont_use_identity_map :only => :some_strange_action
end


82
83
84
# File 'lib/identity_map/action_controller/dispatcher.rb', line 82

def dont_use_identity_map(*args)
  around_filter :without_identity_map, *args
end

#use_dispatcher_identity_mapObject

Put identity map creation onto lower level, actually on a dispatcher may be for use in a Metal or Rack actions



88
89
90
91
92
93
94
95
96
# File 'lib/identity_map/action_controller/dispatcher.rb', line 88

def use_dispatcher_identity_map
  if defined? ::ActionDispatch
    ActionDispatch::Callbacks.before :create_identity_map
    ActionDispatch::Callbacks.after :remove_identity_map
  else
    ActionController::Dispatcher.before_dispatch :create_identity_map
    ActionController::Dispatcher.after_dispatch :remove_identity_map
  end
end

#use_identity_map(*args) ⇒ Object

Puts around filter which is enable identity map usage for actions.

use_identity_map *args is shorthand for around_filter :with_identity_map, *args

Typically you could put it in a ApplicationController

class ApplicationController
  use_identity_map
end


70
71
72
# File 'lib/identity_map/action_controller/dispatcher.rb', line 70

def use_identity_map(*args)
  around_filter :with_identity_map, *args
end