Flowdock
method

replace_named_bind_variables

Importance_0
v1.0.0 - Show latest stable - 0 notes - Class: ActiveRecord::Base
replace_named_bind_variables(statement, bind_vars) 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/base.rb, line 1136
        def replace_named_bind_variables(statement, bind_vars)
          raise_if_bind_arity_mismatch(statement, statement.scan(/:(\w+)/).uniq.size, bind_vars.size)
          statement.gsub(/:(\w+)/) do
            match = $1.to_sym
            if bind_vars.include?(match)
              quote_bound_value(bind_vars[match])
            else
              raise PreparedStatementInvalid, "missing value for :#{match} in #{statement}"
            end
          end
        end
Register or log in to add new notes.