This project is archived and is in readonly mode.
db:sessions:clear to respect legacy table names
-
CancelProfileIsBroken
- Tag changed from databases.rake, minor, patch to bugmash, databases.rake, minor, patch
-
pjammer
+1 for this patch. it gives the same functionality as the previous rails version. +1 on the relevance of this ticket. While the code is cleaner, someone who have to change the name of the sessions table manually in order for the name to be changed. With the existing code, the rake task wouldn't work.
However, can you pass an argument to the db:sessions:create task? if not, the only way to change the name is to muck around in the migration.
-
Elad Meidar
+1 for the first patch, +1 for relevancy.
You can change the name by specifying:
ActiveRecord::SessionStore::Session.table_name = 'new_session_table_name'in environment.rb
Although the patch fixed db:sessions:clear to to use the custom session table name, it didn't apply to db:sessions:create as pjammer applied, i attached a patch that fixes this issue by overriding the default_table_name method in sessions_generator.rb
few things to keep in mind:
- i thought it would be wise to leave the pluralization conditional in tact, in case there is no custom table name (e.c table is still 'sessions' or 'session').
- i supplied a basic test to ensure that the generator is using the right table name, but i did not check the content of the generated migration, i was unable to run the generator.
tried:
g = Rails::Generator::Base.instance('session_migration') g.command(:create).invoke!which resulted in:
undefined method `timestamped_migrations' for ActiveRecord::Base:Class -
Elad Meidar
Sorry, patch apply to 2-3-stable, not master.
-
Elad Meidar
here is the patch to master.
-
Dan Croak
What tests should be run to verify this patch?
The fix_sessions patch applies cleanly in 2-3-stable and rake test runs green for railties.
However, I'm not sure I'm running the right tests.
-
Blue Box Jesse
+1
Patch applies cleanly on 2-3-stable.
Railties tests pass.
Seems ready to go!
-
CancelProfileIsBroken
- Tag changed from bugmash, databases.rake, minor, patch to bugmash-review, databases.rake, minor, patch
-
Rizwan Reza
- Tag changed from bugmash-review, databases.rake, minor, patch to bugmash, databases.rake, minor, patch
-
Priit Tamboom
It looks like master's db:sessions:clean already honors
ActiveRecord::SessionStore::Session.table_name:
http://github.com/rails/rails/blob/master/activerecord/lib/active_r...and master's db:sessions:create also honors custom table_name:
http://github.com/rails/rails/blob/master/activerecord/lib/rails/ge...I suggest we can call this ticket fixed for master.
-
Priit Tamboom
+1 to close the ticket because fix it's already in master
-
jslag
Agree with Priit, master already gets this right.
+1 to closing the ticket.
-
Rizwan Reza
- Tag changed from bugmash, databases.rake, minor, patch to databases.rake, minor, patch
- State changed from new to resolved
