File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11
22MASTER
33
4- *
4+ * Update table_exists? to work with qualified table names that may include an user prefix. [Ken Collins]
55
66
77* 2.2.10/11 * (January 22nd, 2009)
8383 will run quickly. [Ken Collins]
8484
8585* Add views support. ActiveRecord classes can use views. The connection now has a #views method and
86- #table_exists? will not fall back to checking views too. [Ken Collins]
86+ #table_exists? will now fall back to checking views too. [Ken Collins]
8787
8888
89892.2.0 (November 21st, 2008)
Original file line number Diff line number Diff line change @@ -497,7 +497,7 @@ def view_table_name(table_name)
497497 end
498498
499499 def table_exists? ( table_name )
500- super || views . include? ( table_name . to_s )
500+ super || tables . include? ( unqualify_table_name ( table_name ) ) || views . include? ( table_name . to_s )
501501 end
502502
503503 def indexes ( table_name , name = nil )
Original file line number Diff line number Diff line change @@ -39,6 +39,17 @@ def setup
3939 assert @connection . supports_ddl_transactions?
4040 end
4141
42+ should 'allow owner table name prefixs like dbo. to still allow table_exists? to return true' do
43+ begin
44+ assert_equal 'tasks' , Task . table_name
45+ assert Task . table_exists?
46+ Task . table_name = 'dbo.tasks'
47+ assert Task . table_exists? , 'Tasks table name of dbo.tasks should return true for exists.'
48+ ensure
49+ Task . table_name = 'tasks'
50+ end
51+ end
52+
4253 context 'for database version' do
4354
4455 setup do
You can’t perform that action at this time.
0 commit comments