aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-04 18:18:28 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-05-04 18:18:28 -0700
commit92c2fd2a2fe029ffe2597134496bdab7f1ed4de6 (patch)
treec14b3e21bc6c778c6c135c4b497bb5295d692489
parent6b28dcfa7e03909b69b922e26eb6d3ad8eb3f061 (diff)
downloadrails-92c2fd2a2fe029ffe2597134496bdab7f1ed4de6.tar.gz
rails-92c2fd2a2fe029ffe2597134496bdab7f1ed4de6.tar.bz2
rails-92c2fd2a2fe029ffe2597134496bdab7f1ed4de6.zip
introducing structural recursion
-rw-r--r--lib/arel/relations.rb1
-rw-r--r--lib/arel/relations/alias.rb15
-rw-r--r--lib/arel/relations/table.rb14
3 files changed, 5 insertions, 25 deletions
diff --git a/lib/arel/relations.rb b/lib/arel/relations.rb
index 96aa8e9d35..6cd599ad5d 100644
--- a/lib/arel/relations.rb
+++ b/lib/arel/relations.rb
@@ -1,3 +1,4 @@
+require 'arel/relations/recursion'
require 'arel/relations/relation'
require 'arel/relations/nil'
require 'arel/relations/compound'
diff --git a/lib/arel/relations/alias.rb b/lib/arel/relations/alias.rb
index 0099a794b4..08be02e862 100644
--- a/lib/arel/relations/alias.rb
+++ b/lib/arel/relations/alias.rb
@@ -1,5 +1,7 @@
module Arel
class Alias < Compound
+ include Recursion::BaseCase
+
def initialize(relation)
@relation = relation
end
@@ -7,18 +9,5 @@ module Arel
def ==(other)
equal? other
end
-
- def table
- self
- end
-
- def relation_for(attribute)
- self[attribute] and self
- end
-
- def table_sql(formatter = Sql::TableReference.new(self))
- formatter.table self
- end
-
end
end \ No newline at end of file
diff --git a/lib/arel/relations/table.rb b/lib/arel/relations/table.rb
index 75593731e0..735159508e 100644
--- a/lib/arel/relations/table.rb
+++ b/lib/arel/relations/table.rb
@@ -1,5 +1,7 @@
module Arel
class Table < Relation
+ include Recursion::BaseCase
+
cattr_accessor :engine
attr_reader :name, :engine
@@ -19,18 +21,6 @@ module Arel
self[attribute] and columns.detect { |c| c.name == attribute.name.to_s }
end
- def table
- self
- end
-
- def relation_for(attribute)
- self[attribute] and self
- end
-
- def table_sql(formatter = Sql::TableReference.new(self))
- formatter.table self
- end
-
def ==(other)
self.class == other.class and
name == other.name