Flowdock
method

create_binds_for_hash

Importance_0
v5.0.0.1 - Show latest stable - 0 notes - Class: ActiveRecord::PredicateBuilder
  • 1.0.0
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1 (0)
  • 5.1.7 (0)
  • 5.2.3
  • 6.0.0
  • 6.1.3.1
  • 6.1.7.7
  • 7.0.0
  • 7.1.3.2
  • What's this?
create_binds_for_hash(attributes) protected

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/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
Register or log in to add new notes.