# activerecord-spanner-adapter - Class ActiveRecord::Base (v2.2.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.2.0 (latest)](https://docs.cloud.google.com/ruby/docs/reference/activerecord-spanner-adapter/latest/ActiveRecord-Base)
- [2.1.0](https://docs.cloud.google.com/ruby/docs/reference/activerecord-spanner-adapter/2.1.0/ActiveRecord-Base)
- [2.0.0](https://docs.cloud.google.com/ruby/docs/reference/activerecord-spanner-adapter/2.0.0/ActiveRecord-Base)
Reference documentation and code samples for the activerecord-spanner-adapter class ActiveRecord::Base.

## Inherits

- Object

## Methods

### ._buffer_record

    def self._buffer_record(values, method, returning)

### ._convert_primary_key

    def self._convert_primary_key(primary_key_value, returning)

### ._has_all_primary_key_values?

    def self._has_all_primary_key_values?(primary_key, values) -> Boolean

**Returns**

- (Boolean)

### ._insert_record

    def self._insert_record(*args)

### ._insert_record_dml

    def self._insert_record_dml(values, returning)

### ._internal_insert_record

    def self._internal_insert_record(values)

### ._set_composite_primary_key_value

    def self._set_composite_primary_key_value(primary_key, values, is_mutation)

### ._set_composite_primary_key_values

    def self._set_composite_primary_key_values(primary_key, values, is_mutation)

### ._set_primary_key_value

    def self._set_primary_key_value(values, is_mutation)

### ._set_single_primary_key_value

    def self._set_single_primary_key_value(primary_key, values, is_mutation)

### ._should_use_standard_insert_record?

    def self._should_use_standard_insert_record?(values) -> Boolean

**Returns**

- (Boolean)

### ._upsert_record

    def self._upsert_record(values, returning)

### .active_transaction?

    def self.active_transaction?() -> Boolean

**Returns**

- (Boolean)

### .buffered_mutations?

    def self.buffered_mutations?() -> Boolean

**Returns**

- (Boolean)

### .create

    def self.create(attributes = nil, &block)

### .create!

    def self.create!(attributes = nil, &block)

Creates an object (or multiple objects) and saves it to the database. This method will use mutations instead
of DML if there is no active transaction, or if the active transaction has been created with the option
isolation: :buffered_mutations.

### .delete_all

    def self.delete_all()

Deletes all records of this class. This method will use mutations instead of DML if there is no active
transaction, or if the active transaction has been created with the option isolation: :buffered_mutations.

### .has_auto_generated_primary_key?

    def self.has_auto_generated_primary_key?() -> Boolean

**Returns**

- (Boolean)

### .insert!

    def self.insert!(attributes, returning: nil, **kwargs)

### .insert_all

    def self.insert_all(attributes, returning: nil, **_kwargs)

### .insert_all!

    def self.insert_all!(attributes, returning: nil, **_kwargs)

### .is_auto_generated?

    def self.is_auto_generated?(col) -> Boolean

**Returns**

- (Boolean)

### .spanner_adapter?

    def self.spanner_adapter?() -> Boolean

**Returns**

- (Boolean)

### .unwrap_attribute

    def self.unwrap_attribute(attr_or_value)

### .upsert

    def self.upsert(attributes, returning: nil, **kwargs)

### .upsert_all

    def self.upsert_all(attributes, returning: nil, unique_by: nil, **kwargs)

### #destroy

    def destroy()

Deletes the object in the database. This method will use mutations instead
of DML if there is no active transaction, or if the active transaction has been created with the option
isolation: :buffered_mutations.

### #update

    def update(attributes)

Updates the given attributes of the object in the database. This method will use mutations instead
of DML if there is no active transaction, or if the active transaction has been created with the option
isolation: :buffered_mutations.

## Constants

### VERSION_7_1

**value:**Gem::Version.create "7.1.0"

### VERSION_7_2

**value:**Gem::Version.create "7.2.0"