diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-03-18 07:31:01 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-03-18 07:31:01 +0000 |
commit | 229c0f4367be3c766886d75b51e3c15ee8916fc2 (patch) | |
tree | 47bcb766fefb4f808406f1ec8a1b52eb345b06b6 /activerecord/test/adapter_test.rb | |
parent | f1a350a05c97d6e54e6dde26c101e8035d55e40c (diff) | |
download | rails-229c0f4367be3c766886d75b51e3c15ee8916fc2.tar.gz rails-229c0f4367be3c766886d75b51e3c15ee8916fc2.tar.bz2 rails-229c0f4367be3c766886d75b51e3c15ee8916fc2.zip |
Rework table aliasing to account for truncated table aliases. Add smarter table aliasing when doing eager loading of STI associations. This allows you to use the association name in the order/where clause. [Jonathan Viney / Rick Olson] closes #4108
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3921 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/adapter_test.rb')
-rw-r--r-- | activerecord/test/adapter_test.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/adapter_test.rb b/activerecord/test/adapter_test.rb index 2c98045cee..af94904eee 100644 --- a/activerecord/test/adapter_test.rb +++ b/activerecord/test/adapter_test.rb @@ -47,16 +47,18 @@ class AdapterTest < Test::Unit::TestCase end def test_table_alias - old = @connection.table_alias_length - def @connection.table_alias_length() 10; end + def @connection.test_table_alias_length() 10; end + class << @connection + alias_method :old_table_alias_length, :table_alias_length + alias_method :table_alias_length, :test_table_alias_length + end assert_equal 'posts', @connection.table_alias_for('posts') - assert_equal 'posts', @connection.table_alias_for('posts', 1) - assert_equal 'posts_2', @connection.table_alias_for('posts', 2) assert_equal 'posts_comm', @connection.table_alias_for('posts_comments') - assert_equal 'posts_co_2', @connection.table_alias_for('posts_comments', 2) - def @connection.table_alias_length() old; end + class << @connection + alias_method :table_alias_length, :old_table_alias_length + end end # test resetting sequences in odd tables in postgreSQL |