aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-03-26 04:13:25 +0000
committerRick Olson <technoweenie@gmail.com>2006-03-26 04:13:25 +0000
commita5991d849175c2ae9b803486f61b610fad9fd87e (patch)
tree3986d7a3ecb80497bd9ec9f72100de4e6bc47cc6 /activerecord
parent56af14d5aaa0f052d0abe0e06f60b23167c869ff (diff)
downloadrails-a5991d849175c2ae9b803486f61b610fad9fd87e.tar.gz
rails-a5991d849175c2ae9b803486f61b610fad9fd87e.tar.bz2
rails-a5991d849175c2ae9b803486f61b610fad9fd87e.zip
Change periods (.) in table aliases to _'s. Closes #4251 [jeff@ministrycentered.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4039 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb2
-rw-r--r--activerecord/test/adapter_test.rb1
3 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index f21d6e7f97..a1a0e63c86 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Change periods (.) in table aliases to _'s. Closes #4251 [jeff@ministrycentered.com]
+
* Changed has_and_belongs_to_many join to INNER JOIN for Mysql 3.23.x. Closes #4348 [Rick]
* Fixed issue that kept :select options from being scoped [Rick]
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 8c94f07db9..c005282223 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -15,7 +15,7 @@ module ActiveRecord
# Truncates a table alias according to the limits of the current adapter.
def table_alias_for(table_name)
- table_name[0..table_alias_length-1]
+ table_name[0..table_alias_length-1].gsub(/\./, '_')
end
# def tables(name = nil) end
diff --git a/activerecord/test/adapter_test.rb b/activerecord/test/adapter_test.rb
index 93e1ca973b..3da1bf3e54 100644
--- a/activerecord/test/adapter_test.rb
+++ b/activerecord/test/adapter_test.rb
@@ -57,6 +57,7 @@ class AdapterTest < Test::Unit::TestCase
assert_equal 'posts', @connection.table_alias_for('posts')
assert_equal 'posts_comm', @connection.table_alias_for('posts_comments')
+ assert_equal 'dbo_posts', @connection.table_alias_for('dbo.posts')
class << @connection
alias_method :table_alias_length, :old_table_alias_length