123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::StatementInvalid

Overview

Superclass for all database execution errors.

Wraps the underlying database error as cause.

Class Method Summary

Instance Attribute Summary

AdapterError - Inherited

Instance Method Summary

Constructor Details

.new(message = nil, sql: nil, binds: nil, connection_pool: nil) ⇒ StatementInvalid

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 205

def initialize(message = nil, sql: nil, binds: nil, connection_pool: nil)
  super(message || $!&.message, connection_pool: connection_pool)
  @sql = sql
  @binds = binds
end

Instance Attribute Details

#binds (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 211

attr_reader :sql, :binds

#sql (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 211

attr_reader :sql, :binds

Instance Method Details

#set_query(sql, binds)

[ GitHub ]

  
# File 'activerecord/lib/active_record/errors.rb', line 213

def set_query(sql, binds)
  unless @sql
    @sql = sql
    @binds = binds
  end

  self
end