Use Active Record session store

This commit is contained in:
Thibault Jouan 2011-08-04 23:02:40 +00:00
parent cec8a18d42
commit 18b254e3d1
3 changed files with 29 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.
Scube::Application.config.session_store :cookie_store, :key => '_scube_session'
#Scube::Application.config.session_store :cookie_store, :key => '_scube_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Scube::Application.config.session_store :active_record_store
Scube::Application.config.session_store :active_record_store

View File

@ -0,0 +1,16 @@
class AddSessionsTable < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sessions
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110726101228) do
ActiveRecord::Schema.define(:version => 20110804225816) do
create_table "playlists", :force => true do |t|
t.string "name"
@ -18,6 +18,16 @@ ActiveRecord::Schema.define(:version => 20110726101228) do
t.datetime "updated_at"
end
create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
create_table "tracks", :force => true do |t|
t.string "name"
t.datetime "created_at"