module ActiveRecord::Explain

Private Instance Methods

render_bind(attr) click to toggle source
# File lib/active_record/explain.rb, line 39
def render_bind(attr)
  if ActiveModel::Attribute === attr
    value = if attr.type.binary? && attr.value
      "<#{attr.value_for_database.to_s.bytesize} bytes of binary data>"
    else
      connection.type_cast(attr.value_for_database)
    end
  else
    value = connection.type_cast(attr)
    attr  = nil
  end

  [attr&.name, value]
end