Flowdock
method

replace_named_bind_variables

Importance_0
v3.2.13 - Show latest stable - 0 notes - Class: ClassMethods
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/sanitization.rb, line 134
      def replace_named_bind_variables(statement, bind_vars) #:nodoc:
        statement.gsub(/(:?):([a-zA-Z]\w*)/) do
          if $1 == ':' # skip postgresql casts
            $& # return the whole match
          elsif bind_vars.include?(match = $2.to_sym)
            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.