aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-30 23:42:26 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-30 23:42:26 -0700
commitf48c642852b5bb6be62dbbc7502d34b64e53716b (patch)
tree50b65f7ff7253201924336fa65eb6481df913f84 /lib
parent57d6bce28b07f864c97a7b58d758fd5621196b00 (diff)
downloadrails-f48c642852b5bb6be62dbbc7502d34b64e53716b.tar.gz
rails-f48c642852b5bb6be62dbbc7502d34b64e53716b.tar.bz2
rails-f48c642852b5bb6be62dbbc7502d34b64e53716b.zip
the big obstacle
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/relations/alias.rb12
-rw-r--r--lib/arel/relations/compound.rb2
-rw-r--r--lib/arel/relations/join.rb5
-rw-r--r--lib/arel/relations/relation.rb9
4 files changed, 11 insertions, 17 deletions
diff --git a/lib/arel/relations/alias.rb b/lib/arel/relations/alias.rb
index 2dab52515f..329f94638e 100644
--- a/lib/arel/relations/alias.rb
+++ b/lib/arel/relations/alias.rb
@@ -2,18 +2,12 @@ module Arel
class Alias < Compound
attr_reader :alias
- def initialize(relation, aliaz)
- @relation, @alias = relation, aliaz
- end
-
- def alias?
- true
+ def initialize(relation)
+ @relation = relation
end
def ==(other)
- self.class == other.class and
- relation == other.relation and
- @alias == other.alias
+ self.equal? other
end
end
end \ No newline at end of file
diff --git a/lib/arel/relations/compound.rb b/lib/arel/relations/compound.rb
index 4ffac6d1c3..ae848433be 100644
--- a/lib/arel/relations/compound.rb
+++ b/lib/arel/relations/compound.rb
@@ -5,7 +5,7 @@ module Arel
hash_on :relation
delegate :joins, :selects, :orders, :groupings, :table_sql, :inserts, :taken,
- :skipped, :name, :alias, :aggregation?, :alias?, :prefix_for, :column_for,
+ :skipped, :name, :alias, :aggregation?, :prefix_for, :column_for,
:engine,
:to => :relation
diff --git a/lib/arel/relations/join.rb b/lib/arel/relations/join.rb
index ce236d79d0..6c12a0ea26 100644
--- a/lib/arel/relations/join.rb
+++ b/lib/arel/relations/join.rb
@@ -48,6 +48,11 @@ module Arel
[relation1.joins, relation2.joins, this_join].compact.join(" ")
end
+ # FIXME
+ def name
+ 'user'
+ end
+
def selects
(externalize(relation1).selects + externalize(relation2).selects).collect { |s| s.bind(self) }
end
diff --git a/lib/arel/relations/relation.rb b/lib/arel/relations/relation.rb
index 0a5bf2ff24..3453b9adc6 100644
--- a/lib/arel/relations/relation.rb
+++ b/lib/arel/relations/relation.rb
@@ -52,8 +52,8 @@ module Arel
attributes.all?(&:blank?) ? self : Projection.new(self, *attributes)
end
- def as(aliaz = nil)
- aliaz.blank?? self : Alias.new(self, aliaz)
+ def alias
+ Alias.new(self)
end
def order(*attributes)
@@ -100,10 +100,6 @@ module Arel
false
end
- def alias?
- false
- end
-
def relation_for(attribute)
self[attribute] and self
end
@@ -166,6 +162,5 @@ module Arel
def joins; nil end
def taken; nil end
def skipped; nil end
- def alias; nil end
end
end \ No newline at end of file