The comments in:
actionpack/lib/action_controller/session/activerecord_store.rb
document this method for changing the session table_name:
# You may configure the table name, primary key, and data column. # For example, at the end of config/environment.rb: # CGI::Session::ActiveRecordStore::Session.table_name = 'legacy_session_table' # CGI::Session::ActiveRecordStore::Session.primary_key = 'session_id' # CGI::Session::ActiveRecordStore::Session.data_column_name = 'legacy_session_data'
I am using this method to set a custom table name in the database for my sessions table.
This works fine however there's a problem with the following rake tasks:
rake db:sessions:clear rake db:sessions:create
in file: railties/lib/tasks/databases.rb
They instead use the state of ActiveRecord::Base.pluralize_table_names to set the table mane to either 'session' or 'sessions'.
I started working on a patch but got confused figuring out where table_name is defined in activerecord_store.rb.
It's defined once as a cattr in this Class:
CGI::Session::ActiveRecordStore::SqlBypass.table_name
and again somehow in this class:
CGI::Session::ActiveRecordStore::Session.table_name
Any suggestions on how the patch should be constructed?