Class: ActiveRecord::SessionStore::Session

Inherits:
Base
  • Object
show all
Extended by:
ClassMethods
Defined in:
lib/active_record/session_store.rb

Overview

The default Active Record class.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

create_table!, drop_table!, marshal, unmarshal

Methods inherited from Base

#==, ===, #[], #[]=, abstract_class?, arel_engine, arel_table, attr_readonly, #attribute_for_inspect, attribute_method?, #attribute_names, #attribute_present?, #attributes, #attributes=, base_class, before_remove_const, #cache_key, colorize_logging, #column_for_attribute, column_methods_hash, column_names, columns, columns_hash, #configurations, connected?, connection, #connection, #connection_handler, connection_pool, content_columns, count_by_sql, create, #default_timezone, descends_from_active_record?, #dup, #eql?, 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_copy, #inspect, inspect, #logger, lookup_ancestors, 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_column_information_and_inheritable_attributes_for_all_subclasses, reset_sequence_name, reset_subclasses, reset_table_name, respond_to?, retrieve_connection, sanitize, #schema_format, scoped_methods, sequence_name, serialize, serialized_attributes, set_inheritance_column, set_sequence_name, set_table_name, sqlite3_connection, sti_name, subclasses, table_exists?, table_name, #table_name_prefix, #table_name_suffix, #timestamped_migrations, #to_param, unscoped

Constructor Details

#initialize(attributes = nil) ⇒ Session

Returns a new instance of Session.



124
125
126
127
# File 'lib/active_record/session_store.rb', line 124

def initialize(attributes = nil)
  @data = nil
  super
end

Instance Attribute Details

#dataObject

Lazy-unmarshal session state.



130
131
132
# File 'lib/active_record/session_store.rb', line 130

def data
  @data ||= self.class.unmarshal(read_attribute(@@data_column_name)) || {}
end

Class Method Details

.data_column_size_limitObject



88
89
90
# File 'lib/active_record/session_store.rb', line 88

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.



93
94
95
96
# File 'lib/active_record/session_store.rb', line 93

def find_by_session_id(session_id)
  setup_sessid_compatibility!
  find_by_session_id(session_id)
end

Instance Method Details

#data_column_nameObject

:singleton-method: Customizable data column name. Defaults to ‘data’.



81
# File 'lib/active_record/session_store.rb', line 81

cattr_accessor :data_column_name

#loaded?Boolean

Has the session been loaded yet?

Returns:

  • (Boolean)


137
138
139
# File 'lib/active_record/session_store.rb', line 137

def loaded?
  @data
end