method
build
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::Relation::WhereClauseFactory
build(opts, other)public
No documentation available.
# File activerecord/lib/active_record/relation/where_clause_factory.rb, line 11
def build(opts, other)
case opts
when String, Array
parts = [klass.sanitize_sql(other.empty? ? opts : ([opts] + other))]
when Hash
attributes = predicate_builder.resolve_column_aliases(opts)
attributes.stringify_keys!
parts = predicate_builder.build_from_hash(attributes)
when Arel::Nodes::Node
parts = [opts]
else
raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
end
WhereClause.new(parts)
end