Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Record 7 Updates #14485

Merged
merged 6 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions v22.1/build-a-ruby-app-with-cockroachdb-activerecord.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
title: Build a Ruby App with CockroachDB and ActiveRecord
summary: Learn how to use CockroachDB from a simple Ruby script with the ActiveRecord gem.
title: Build a Ruby App with CockroachDB and Active Record
summary: Learn how to use CockroachDB from a simple Ruby script with the Active Record gem.
toc: true
twitter: false
referral_id: docs_ruby_activerecord
filter_category: crud_ruby
filter_html: Use <strong>ActiveRecord</strong>
filter_html: Use <strong>Active Record</strong>
filter_sort: 2
docs_area: get_started
---

{% include filter-tabs.md %}

This tutorial shows you how build a simple Ruby application with CockroachDB and [ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html). CockroachDB provides an ActiveRecord adapter for CockroachDB as a [RubyGem](https://rubygems.org/gems/activerecord-cockroachdb-adapter).
This tutorial shows you how build a simple Ruby application with CockroachDB and [Active Record](http://guides.rubyonrails.org/active_record_basics.html). CockroachDB provides an Active Record adapter for CockroachDB as a [RubyGem](https://rubygems.org/gems/activerecord-cockroachdb-adapter).

{{site.data.alerts.callout_success}}
For a more realistic use of ActiveRecord with CockroachDB in a Rails app, see our [`examples-orms`](https://github.com/cockroachdb/examples-orms) repository.
For a more realistic use of Active Record with CockroachDB in a Rails app, see our [`examples-orms`](https://github.com/cockroachdb/examples-orms) repository.
{{site.data.alerts.end}}

## Step 1. Start CockroachDB
Expand Down Expand Up @@ -104,6 +104,6 @@ git clone https://github.com/cockroachlabs/example-app-ruby-activerecord

## What's next?

Read more about using [ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html), or check out a more realistic implementation of ActiveRecord with CockroachDB in a Rails app in our [`examples-orms`](https://github.com/cockroachdb/examples-orms) repository.
Read more about using [Active Record](http://guides.rubyonrails.org/active_record_basics.html), or check out a more realistic implementation of Active Record with CockroachDB in a Rails app in our [`examples-orms`](https://github.com/cockroachdb/examples-orms) repository.

{% include {{page.version.version}}/app/see-also-links.md %}
10 changes: 5 additions & 5 deletions v22.1/connect-to-the-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ Parameter | Description

<div class="filters clearfix">
<button class="filter-button page-level" data-scope="ruby-pg">pg</button>
<button class="filter-button page-level" data-scope="activerecord">ActiveRecord</button>
<button class="filter-button page-level" data-scope="activerecord">Active Record</button>
</div>

{{site.data.alerts.callout_info}}
Expand Down Expand Up @@ -1120,7 +1120,7 @@ For more information about connecting with pg, see the [official pg documentatio

<div>

To connect to CockroachDB with [ActiveRecord](https://github.com/rails/rails/tree/main/activerecord) from a Rails app, update the database configuration in `config/database.yml`:
To connect to CockroachDB with [Active Record](https://github.com/rails/rails/tree/main/activerecord) from a Rails app, update the database configuration in `config/database.yml`:

~~~ yaml
default: &default
Expand All @@ -1132,7 +1132,7 @@ default: &default

Where `DATABASE_URL` is an environment variable set to a valid CockroachDB connection string.

ActiveRecord accepts the following format for CockroachDB connection strings:
Active Record accepts the following format for CockroachDB connection strings:

</div>

Expand Down Expand Up @@ -1164,10 +1164,10 @@ cockroachdb://{username}@{host}:{port}/{database}?sslmode=verify-full&sslrootcer
</div>

{{site.data.alerts.callout_info}}
To connect to CockroachDB with ActiveRecord, you must install the [ActiveRecord CockroachDB adapter](https://rubygems.org/gems/activerecord-cockroachdb-adapter).
To connect to CockroachDB with Active Record, you must install the [Active Record CockroachDB adapter](https://rubygems.org/gems/activerecord-cockroachdb-adapter).
{{site.data.alerts.end}}

For more information about connecting with ActiveRecord, see the [official ActiveRecord documentation](https://guides.rubyonrails.org/active_record_querying.html).
For more information about connecting with Active Record, see the [official Active Record documentation](https://guides.rubyonrails.org/active_record_querying.html).

</div>

Expand Down
2 changes: 1 addition & 1 deletion v22.1/example-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Note that tools with [**community-level** support](community-tooling.html) have
| Driver/ORM Framework | Support level | Example apps |
|-----------------------------------------------------------+----------------+--------------------------------------------------------|
| [pg](https://rubygems.org/gems/pg) | Full | [Simple CRUD](build-a-ruby-app-with-cockroachdb.html)
| [ActiveRecord](https://rubygems.org/gems/activerecord) | Full | [Simple CRUD](build-a-ruby-app-with-cockroachdb-activerecord.html)
| [Active Record](https://rubygems.org/gems/activerecord) | Full | [Simple CRUD](build-a-ruby-app-with-cockroachdb-activerecord.html)

## C#

Expand Down
8 changes: 4 additions & 4 deletions v22.1/install-client-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,22 @@ For a simple but complete example app, see [Build a Ruby App with CockroachDB an

## Ruby ORM frameworks

### ActiveRecord
### Active Record

**Support level:** Full

To install ActiveRecord, the [pg driver](https://rubygems.org/gems/pg), and a [CockroachDB Ruby package](https://github.com/cockroachdb/activerecord-cockroachdb-adapter) that accounts for some minor differences between CockroachDB and PostgreSQL:
To install Active Record, the [pg driver](https://rubygems.org/gems/pg), and a [CockroachDB Ruby package](https://github.com/cockroachdb/activerecord-cockroachdb-adapter) that accounts for some minor differences between CockroachDB and PostgreSQL:

{% include_cached copy-clipboard.html %}
~~~ shell
$ gem install activerecord pg activerecord-cockroachdb-adapter
~~~

{{site.data.alerts.callout_info}}
The exact command above will vary depending on the desired version of ActiveRecord. Specifically, version 5.1.x of ActiveRecord requires version 0.2.x of the adapter; version 5.2.x of ActiveRecord requires version 5.2.x of the adapter; version 6.0.x of ActiveRecord requires version 6.0.x of the adapter.
The exact command above will vary depending on the desired version of Active Record. Specifically, version 5.1.x of Active Record requires version 0.2.x of the adapter; version 5.2.x of Active Record requires version 5.2.x of the adapter; version 6.0.x of Active Record requires version 6.0.x of the adapter; version 7.0.x of Active Record requires version 7.0.x of the adapter.
{{site.data.alerts.end}}

For a simple but complete example app, see [Build a Ruby App with CockroachDB and ActiveRecord](build-a-ruby-app-with-cockroachdb-activerecord.html).
For a simple but complete example app, see [Build a Ruby App with CockroachDB and Active Record](build-a-ruby-app-with-cockroachdb-activerecord.html).

</section>

Expand Down
4 changes: 2 additions & 2 deletions v22.1/spatial-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The following ORM spatial libraries are fully compatible with CockroachDB's spat

[Hibernate 5.4.30.Final](https://in.relation.to/2021/03/19/hibernate-orm-5430-final-release/) added the `CockroachDB202SpatialDialect` dialect to the `hibernate-spatial` module. The `CockroachDB202SpatialDialect` dialect supports spatial features available in CockroachDB v20.2 and later.

- [RGeo/RGeo-ActiveRecord](https://github.com/rgeo/rgeo-activerecord)
- [RGeo/RGeo-Active Record](https://github.com/rgeo/rgeo-activerecord)
gemma-shay marked this conversation as resolved.
Show resolved Hide resolved

CockroachDB's ActiveRecord adapter ([`activerecord-cockroachdb-adapter`](https://github.com/cockroachdb/activerecord-cockroachdb-adapter)) uses [RGeo](https://github.com/rgeo/rgeo) and [RGeo-ActiveRecord](https://github.com/rgeo/rgeo-activerecord) for spatial support with ActiveRecord v5.2.2+ and v6.0.0+. For information about using CockroachDB spatial features with ActiveRecord, see the [`activerecord-cockroachdb-adapter` README](https://github.com/cockroachdb/activerecord-cockroachdb-adapter#working-with-spatial-data).
CockroachDB's Active Record adapter ([`activerecord-cockroachdb-adapter`](https://github.com/cockroachdb/activerecord-cockroachdb-adapter)) uses [RGeo](https://github.com/rgeo/rgeo) and [RGeo-Active Record](https://github.com/rgeo/rgeo-activerecord) for spatial support with Active Record v5.2.2+, v6.0.0+, and v7.0.0+. For information about using CockroachDB spatial features with Active Record, see the [`activerecord-cockroachdb-adapter` README](https://github.com/cockroachdb/activerecord-cockroachdb-adapter#working-with-spatial-data).

- [GeoDjango](https://github.com/cockroachdb/django-cockroachdb#gis-support)

Expand Down
2 changes: 1 addition & 1 deletion v22.1/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ To handle these types of errors, you have the following options:
- If you're building an application in the following languages, Cockroach Labs has created adapters that include automatic retry handling:
- **Go** developers using [GORM](https://github.com/jinzhu/gorm) or [pgx](https://github.com/jackc/pgx) can use the [`github.com/cockroachdb/cockroach-go/crdb`](https://github.com/cockroachdb/cockroach-go/tree/master/crdb) package. For an example, see [Build a Go App with CockroachDB](build-a-go-app-with-cockroachdb.html).
- **Python** developers using [SQLAlchemy](https://www.sqlalchemy.org) can use the [`sqlalchemy-cockroachdb` adapter](https://github.com/cockroachdb/sqlalchemy-cockroachdb). For an example, see [Build a Python App with CockroachDB and SQLAlchemy](build-a-python-app-with-cockroachdb-sqlalchemy.html).
- **Ruby (ActiveRecord)** developers can use the [`activerecord-cockroachdb-adapter`](https://rubygems.org/gems/activerecord-cockroachdb-adapter). For an example, see [Build a Ruby App with CockroachDB and ActiveRecord](build-a-ruby-app-with-cockroachdb-activerecord.html).
- **Ruby (Active Record)** developers can use the [`activerecord-cockroachdb-adapter`](https://rubygems.org/gems/activerecord-cockroachdb-adapter). For an example, see [Build a Ruby App with CockroachDB and Active Record](build-a-ruby-app-with-cockroachdb-activerecord.html).
- If you're building an application with another driver or data access framework that is [supported by CockroachDB](third-party-database-tools.html), we recommend reusing the retry logic in our ["Simple CRUD" Example Apps](example-apps.html). For example, **Java** developers accessing the database with [JDBC](https://jdbc.postgresql.org) can reuse the example code implementing retry logic shown in [Build a Java app with CockroachDB](build-a-java-app-with-cockroachdb.html).
- If you're building an application with a language and framework for which we do not provide example retry logic, you might need to write your own retry logic. For an example, see the [Client-side intervention example](#client-side-intervention-example).
- **Advanced users, such as library authors**: See [Advanced Client-Side Transaction Retries](advanced-client-side-transaction-retries.html).
Expand Down