Work out which session store class to use automatically.
authorTom Hughes <tom@compton.nu>
Thu, 16 Apr 2009 20:29:18 +0000 (20:29 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 16 Apr 2009 20:29:18 +0000 (20:29 +0000)
config/initializers/sql_session_store.rb

index fd6c11d4447b2f66bfae1fcf8e861369201e9b2c..986037afe3d107d047be03a5c192c57e24b345d0 100644 (file)
@@ -1,2 +1,7 @@
-# Use the MySQL interface for SqlSessionStore
-SqlSessionStore.session_class = MysqlSession
+# Work out which session store adapter to use
+environment = Rails.configuration.environment
+adapter = Rails.configuration.database_configuration[environment]["adapter"]
+session_class = adapter + "_session"
+
+# Configure SqlSessionStore
+SqlSessionStore.session_class = session_class.camelize.constantize