From f2b048529bd8020505baf999fe23a365753a8280 Mon Sep 17 00:00:00 2001 From: kennyj Date: Wed, 7 Mar 2012 02:37:40 +0900 Subject: [PATCH] Revert table_name= needs connection now, so just stub table_name --- activerecord/lib/active_record/model_schema.rb | 2 +- railties/test/generators/session_migration_generator_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 24896801d4..99847ac161 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -118,7 +118,7 @@ module ActiveRecord if defined?(@table_name) return if value == @table_name - reset_column_information + reset_column_information if connected? end @table_name = value diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 89506222df..b590047ff0 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -15,7 +15,7 @@ class SessionMigrationGeneratorTest < Rails::Generators::TestCase end def test_session_migration_with_custom_table_name - ActiveRecord::SessionStore::Session.stubs(:table_name => "custom_table_name") + ActiveRecord::SessionStore::Session.table_name = "custom_table_name" run_generator assert_migration "db/migrate/add_sessions_table.rb" do |migration| assert_match(/class AddSessionsTable < ActiveRecord::Migration/, migration)