diff options
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index f89baa1a74..456de73250 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -1,7 +1,7 @@ module ActiveRecord class Relation delegate :delete, :to_sql, :to => :relation - CLAUSES_METHODS = ["project", "group", "order", "take", "skip"].freeze + CLAUSES_METHODS = ["project", "group", "order", "take", "skip", "on"].freeze attr_reader :relation, :klass def initialize(klass, table = nil) @@ -31,8 +31,14 @@ module ActiveRecord } end - def join(joins) - @relation = @relation.join(@klass.send(:construct_join, joins, nil)) if !joins.blank? + def join(joins, join_type = nil) + if !joins.blank? + if [String, Hash, Array, Symbol].include?(joins.class) + @relation = @relation.join(@klass.send(:construct_join, joins, nil)) + else + @relation = @relation.join(joins, join_type) + end + end self end |