aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r--lib/arel/algebra/relations/utilities/externalization.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/utilities/externalization.rb b/lib/arel/algebra/relations/utilities/externalization.rb
index 815e1e0aa7..8e97573f68 100644
--- a/lib/arel/algebra/relations/utilities/externalization.rb
+++ b/lib/arel/algebra/relations/utilities/externalization.rb
@@ -1,5 +1,7 @@
module Arel
class Externalization < Compound
+ include Recursion::BaseCase
+
def == other
super || Externalization === other && relation == other.relation
end
@@ -11,5 +13,14 @@ module Arel
def attributes
@attributes ||= Header.new(relation.attributes.map { |a| a.to_attribute(self) })
end
+
+ def table_sql(formatter = Sql::TableReference.new(relation))
+ formatter.select relation.compiler.select_sql, self
+ end
+
+ # REMOVEME
+ def name
+ relation.name + '_external'
+ end
end
end