diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/relations/nil.rb | 7 | ||||
-rw-r--r-- | lib/active_relation/relations/relation.rb | 7 |
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) |