From a85530820426f8baa4dbb1fa863313c6a6c69484 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 4 Mar 2011 06:13:22 +0800 Subject: Add an #table_name method to Table and TableAlias, which always returns the actual table name, not the alias. Then fix ToSql#column_for to use this table name when checking whether the table exists (rather than before, where it was checking whether a table with the alias name exists, which was incorrect). --- lib/arel/visitors/to_sql.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/arel/visitors/to_sql.rb') diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 70e10a5e0f..f76c1491ee 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -88,7 +88,7 @@ key on UpdateManager using UpdateManager#key= def column_for attr name = attr.name.to_s - table = attr.relation.name + table = attr.relation.table_name return nil unless table_exists? table -- cgit v1.2.3