method

create_binds_for_hash

create_binds_for_hash(attributes)
protected

No documentation available.

# File activerecord/lib/active_record/relation/predicate_builder.rb, line 96
    def create_binds_for_hash(attributes)
      result = attributes.dup
      binds = []

      attributes.each do |column_name, value|
        case value
        when Hash
          attrs, bvs = associated_predicate_builder(column_name).create_binds_for_hash(value)
          result[column_name] = attrs
          binds += bvs
        when Relation
          binds += value.bound_attributes
        when Range
          first = value.begin
          last = value.end
          unless first.respond_to?(:infinite?) && first.infinite?
            binds << build_bind_param(column_name, first)
            first = Arel::Nodes::BindParam.new
          end
          unless last.respond_to?(:infinite?) && last.infinite?
            binds << build_bind_param(column_name, last)
            last = Arel::Nodes::BindParam.new
          end

          result[column_name] = RangeHandler::RangeWithBinds.new(first, last, value.exclude_end?)
        else
          if can_be_bound?(column_name, value)
            result[column_name] = Arel::Nodes::BindParam.new
            binds << build_bind_param(column_name, value)
          end
        end
      end

      [result, binds]
    end