Methods
Public Instance methods
[ show source ]
# File actionpack/lib/action_controller/session_management.rb, line 45 45: def session(*args) 46: ActiveSupport::Deprecation.warn( 47: "Disabling sessions for a single controller has been deprecated. " + 48: "Sessions are now lazy loaded. So if you don't access them, " + 49: "consider them off. You can still modify the session cookie " + 50: "options with request.session_options.", caller) 51: end
[ show source ]
# File actionpack/lib/action_controller/session_management.rb, line 33 33: def session=(options = {}) 34: self.session_store = nil if options.delete(:disabled) 35: session_options.merge!(options) 36: end
Returns the hash used to configure the session. Example use:
ActionController::Base.session_options[:secure] = true # session only available over HTTPS
[ show source ]
# File actionpack/lib/action_controller/session_management.rb, line 41 41: def session_options 42: @session_options ||= {} 43: end
Returns the session store class currently used.
[ show source ]
# File actionpack/lib/action_controller/session_management.rb, line 25 25: def session_store 26: if defined? @@session_store 27: @@session_store 28: else 29: Session::CookieStore 30: end 31: end
Set the session store to be used for keeping the session data between requests. By default, sessions are stored in browser cookies (:cookie_store), but you can also specify one of the other included stores (:active_record_store, :mem_cache_store, or your own custom class.
[ show source ]
# File actionpack/lib/action_controller/session_management.rb, line 14 14: def session_store=(store) 15: if store == :active_record_store 16: self.session_store = ActiveRecord::SessionStore 17: else 18: @@session_store = store.is_a?(Symbol) ? 19: Session.const_get(store.to_s.camelize) : 20: store 21: end 22: end