aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-11 15:53:45 -0700
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-04-11 15:53:45 -0700
commit3967bd524da7b3c0b985c57670ceb7f5d48a0f1b (patch)
tree8e342a0ad2f6b27948731ad1c1433bcfb8aa2f29 /lib
parenteee3a766160cd32a4d9b5e1352858597005c9cee (diff)
downloadrails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.tar.gz
rails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.tar.bz2
rails-3967bd524da7b3c0b985c57670ceb7f5d48a0f1b.zip
string passthrough for joins
Diffstat (limited to 'lib')
-rw-r--r--lib/active_relation/relations/nil.rb7
-rw-r--r--lib/active_relation/relations/relation.rb7
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/active_relation/relations/nil.rb b/lib/active_relation/relations/nil.rb
index b063db92c9..289ba834d8 100644
--- a/lib/active_relation/relations/nil.rb
+++ b/lib/active_relation/relations/nil.rb
@@ -1,5 +1,12 @@
module ActiveRelation
class Nil < Relation
def table_sql; '' end
+
+ def to_s; '' end
+
+ def ==(other)
+ self.class == other.class
+ end
end
+
end \ No newline at end of file
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb
index eebfd48e30..1b80494cd7 100644
--- a/lib/active_relation/relations/relation.rb
+++ b/lib/active_relation/relations/relation.rb
@@ -19,7 +19,12 @@ module ActiveRelation
module Operations
def join(other)
- JoinOperation.new("INNER JOIN", self, other)
+ case other
+ when String
+ Join.new(other, self)
+ when Relation
+ JoinOperation.new("INNER JOIN", self, other)
+ end
end
def outer_join(other)