aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/tasks/databases.rake10
2 files changed, 9 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 0993ff826b..dcd5ef11c7 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Honor ActiveRecord::Base.pluralize_table_names when creating and destroying session store table. #3204. [rails@bencurtis.com, Marcel Molina Jr.]
+
* Update to script.aculo.us 1.5.0 final (equals 1.5.0_rc6) [Thomas Fuchs]
* Update to Prototype 1.4.0 final [Sam Stephenson]
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake
index 83140b1164..1768f0a41a 100644
--- a/railties/lib/tasks/databases.rake
+++ b/railties/lib/tasks/databases.rake
@@ -128,6 +128,10 @@ def prepare_test_database_task
:ruby => :clone_schema_to_test}[ActiveRecord::Base.schema_format]
end
+def session_table_name
+ ActiveRecord::Base.pluralize_table_names ? :sessions : :session
+end
+
desc 'Prepare the test database and load the schema'
task :prepare_test_database => :environment do
Rake::Task[prepare_test_database_task].invoke
@@ -137,20 +141,20 @@ desc "Creates a sessions table for use with CGI::Session::ActiveRecordStore"
task :create_sessions_table => :environment do
raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations?
- ActiveRecord::Base.connection.create_table :sessions do |t|
+ ActiveRecord::Base.connection.create_table session_table_name do |t|
t.column :session_id, :string
t.column :data, :text
t.column :updated_at, :datetime
end
- ActiveRecord::Base.connection.add_index :sessions, :session_id
+ ActiveRecord::Base.connection.add_index session_table_name, :session_id
end
desc "Drop the sessions table"
task :drop_sessions_table => :environment do
raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations?
- ActiveRecord::Base.connection.drop_table :sessions
+ ActiveRecord::Base.connection.drop_table session_table_name
end
desc "Drop and recreate the session table (much faster than 'DELETE * FROM sessions')"