instance method build_where

Ruby on Rails 4.0.13

Since v3.0.20 Last seen in v4.2.9 Private

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

build_where(opts, other = [])

No documentation comment.

Parameters

opts req
other opt = []
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 900
    def build_where(opts, other = [])
      case opts
      when String, Array
        #TODO: Remove duplication with: /activerecord/lib/active_record/sanitization.rb:113
        values = Hash === other.first ? other.first.values : other

        values.grep(ActiveRecord::Relation) do |rel|
          self.bind_values += rel.bind_values
        end

        [@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
      when Hash
        attributes = @klass.send(:expand_hash_conditions_for_aggregates, opts)

        attributes.values.grep(ActiveRecord::Relation) do |rel|
          self.bind_values += rel.bind_values
        end

        PredicateBuilder.build_from_hash(klass, attributes, table)
      else
        [opts]
      end
    end

Defined in activerecord/lib/active_record/relation/query_methods.rb line 900 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::QueryMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close