Flowdock
method

merge_joins

Importance_0
v4.0.2 - Show latest stable - 0 notes - Class: Merger
merge_joins() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/merger.rb, line 81
      def merge_joins
        return if values[:joins].blank?

        if other.klass == relation.klass
          relation.joins!(*values[:joins])
        else
          joins_dependency, rest = values[:joins].partition do |join|
            case join
            when Hash, Symbol, Array
              true
            else
              false
            end
          end

          join_dependency = ActiveRecord::Associations::JoinDependency.new(other.klass,
                                                                           joins_dependency,
                                                                           [])
          relation.joins! rest

          join_dependency.join_associations.each do |association|
            @relation = association.join_relation(relation)
          end
        end
      end
Register or log in to add new notes.