method

build_where

Importance_0
v4.0.2 - Show latest stable - 0 notes - Class: ActiveRecord::QueryMethods
build_where(opts, other = []) 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/query_methods.rb, line 889
    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
Register or log in to add new notes.