@engine = nil class << self; attr_accessor :engine; end - attr_accessor :name, :engine, :aliases, :table_alias + attr_accessor :name, :engine, :aliases, :table_alias, :database_name @@ -18,6 +18,7 @@ module Arel @aliases = [] @table_alias = nil @primary_key = nil + @database_name = nil --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -612,6 +612,7 @@ module Arel end def visit_Arel_Table o, collector + collector << "#{quote_table_name o.database_name}." if o.database_name if o.table_alias collector << "#{quote_table_name o.name} #{quote_table_name o.table_alias}" else