Module: ActiveRecord::SessionStore::ClassMethods

Included in:
Session, SqlBypass
Defined in:
activerecord/lib/active_record/session_store.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#create_table!Object


68
69
70
71
72
73
74
75
# File 'activerecord/lib/active_record/session_store.rb', line 68

def create_table!
  connection.schema_cache.clear_table_cache!(table_name)
  connection.create_table(table_name) do |t|
    t.string session_id_column, :limit => 255
    t.text data_column_name
  end
  connection.add_index table_name, session_id_column, :unique => true
end

#drop_table!Object


63
64
65
66
# File 'activerecord/lib/active_record/session_store.rb', line 63

def drop_table!
  connection.schema_cache.clear_table_cache!(table_name)
  connection.drop_table table_name
end

#marshal(data) ⇒ Object


55
56
57
# File 'activerecord/lib/active_record/session_store.rb', line 55

def marshal(data)
  ::Base64.encode64(Marshal.dump(data)) if data
end

#unmarshal(data) ⇒ Object


59
60
61
# File 'activerecord/lib/active_record/session_store.rb', line 59

def unmarshal(data)
  Marshal.load(::Base64.decode64(data)) if data
end