class method self.add_joins!

Ruby on Rails 2.3.18

Last seen in v2.3.18 Private — implementation detail, not part of the public API

Available in: v2.2.3 v2.3.18

Signature

self.add_joins!(sql, joins, scope = :auto)

The optional scope argument is for the current :find scope.

Parameters

sql req
joins req
scope opt = :auto
Source
# File activerecord/lib/active_record/base.rb, line 1815
        def add_joins!(sql, joins, scope = :auto)
          scope = scope(:find) if :auto == scope
          merged_joins = scope && scope[:joins] && joins ? merge_joins(scope[:joins], joins) : (joins || scope && scope[:joins])
          case merged_joins
          when Symbol, Hash, Array
            if array_of_strings?(merged_joins)
              sql << merged_joins.join(' ') + " "
            else
              join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, merged_joins, nil)
              sql << " #{join_dependency.join_associations.collect { |assoc| assoc.association_join }.join} "
            end
          when String
            sql << " #{merged_joins} "
          end
        end

Defined in activerecord/lib/active_record/base.rb line 1815 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close