Module: SessionOff
- Defined in:
- lib/session_off.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/session_off.rb', line 3 def self.included(base) base.class_eval do extend ClassMethods if instance_methods(false).map(&:to_s).include?('session_enabled?') # remove the "deprecation" Rails 2.3 (can't override) : remove_method 'session_enabled?' end if instance_methods(false).map(&:to_s).include?('reset_session') # we'll have our own that respects session_enabled? # Rails 2.3 has this method in ActionController::Base remove_method 'reset_session' end # attr_internal on ActionController::Base for Rails 2.3.x # 3+ : `delegate :session, :to => "@_request"` from Metal clazz = self while clazz && ! clazz.instance_methods(false).map(&:to_s).include?('session') clazz = clazz.superclass end clazz.send(:remove_method, 'session') if clazz include InstanceMethods alias_method_chain(:process, :session_off) # yet another Rails 2.3 specific hook : alias_method_chain(:assign_shortcuts, :session_off) rescue NameError end end |