Class: ActiveRecord::SessionStore::Session
- Extended by:
- ClassMethods
- Defined in:
- activerecord/lib/active_record/session_store.rb
Overview
The default Active Record class.
Instance Attribute Summary collapse
-
#data ⇒ Object
Lazy-unmarshal session state.
Class Method Summary collapse
- .data_column_size_limit ⇒ Object
-
.find_by_session_id(session_id) ⇒ Object
Hook to set up sessid compatibility.
Instance Method Summary collapse
-
#data_column_name ⇒ Object
:singleton-method: Customizable data column name.
-
#initialize(attributes = nil, options = {}) ⇒ Session
constructor
A new instance of Session.
-
#loaded? ⇒ Boolean
Has the session been loaded yet?.
Methods included from ClassMethods
create_table!, drop_table!, marshal, unmarshal
Methods inherited from Base
#<=>, #==, ===, abstract_class?, arel_engine, arel_table, #assign_attributes, attr_readonly, #attribute_for_inspect, attribute_method?, #attribute_names, attribute_names, #attribute_present?, #attributes, #attributes=, base_class, before_remove_const, #cache_key, clear_active_connections!, clear_cache!, column_defaults, #column_for_attribute, column_methods_hash, column_names, columns, columns_hash, #configurations, connected?, #connection, connection, connection_config, #connection_handler, connection_pool, content_columns, count_by_sql, create, #default_timezone, descends_from_active_record?, #dup, #encode_with, establish_connection, find_by_sql, finder_needs_type_condition?, #freeze, #frozen?, full_table_name_prefix, #has_attribute?, #hash, i18n_scope, inheritance_column, #init_with, #initialize_dup, inspect, #inspect, instantiate, #logger, lookup_ancestors, mysql2_connection, mysql_connection, #pluralize_table_names, postgresql_connection, #primary_key_prefix_type, quote_value, #quoted_id, quoted_table_name, #readonly!, #readonly?, readonly_attributes, remove_connection, reset_column_information, reset_sequence_name, reset_table_name, respond_to?, retrieve_connection, sanitize, #schema_format, sequence_name, serialize, set_inheritance_column, set_sequence_name, set_table_name, sqlite3_connection, sti_name, symbolized_base_class, symbolized_sti_name, table_exists?, table_name, #table_name_prefix, #table_name_suffix, #timestamped_migrations, #to_param, unscoped
Constructor Details
#initialize(attributes = nil, options = {}) ⇒ Session
Returns a new instance of Session.
128 129 130 131 |
# File 'activerecord/lib/active_record/session_store.rb', line 128 def initialize(attributes = nil, = {}) @data = nil super end |
Instance Attribute Details
#data ⇒ Object
Lazy-unmarshal session state.
134 135 136 |
# File 'activerecord/lib/active_record/session_store.rb', line 134 def data @data ||= self.class.unmarshal(read_attribute(@@data_column_name)) || {} end |
Class Method Details
.data_column_size_limit ⇒ Object
92 93 94 |
# File 'activerecord/lib/active_record/session_store.rb', line 92 def data_column_size_limit @data_column_size_limit ||= columns_hash[data_column_name].limit end |
.find_by_session_id(session_id) ⇒ Object
Hook to set up sessid compatibility.
97 98 99 100 |
# File 'activerecord/lib/active_record/session_store.rb', line 97 def find_by_session_id(session_id) setup_sessid_compatibility! find_by_session_id(session_id) end |
Instance Method Details
#data_column_name ⇒ Object
:singleton-method: Customizable data column name. Defaults to ‘data’.
83 |
# File 'activerecord/lib/active_record/session_store.rb', line 83 cattr_accessor :data_column_name |
#loaded? ⇒ Boolean
Has the session been loaded yet?
141 142 143 |
# File 'activerecord/lib/active_record/session_store.rb', line 141 def loaded? @data end |