Skip to content
Browse files

Change periods (.) in table aliases to _'s. Closes #4251 [jeff@minist…

…rycentered.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4039 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 56af14d commit a5991d849175c2ae9b803486f61b610fad9fd87e @technoweenie technoweenie committed Mar 26, 2006
View
2 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]
View
2 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -15,7 +15,7 @@ def table_alias_length
# 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
View
1 activerecord/test/adapter_test.rb
@@ -57,6 +57,7 @@ class << @connection
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

0 comments on commit a5991d8

Please sign in to comment.
Something went wrong with that request. Please try again.