- Retrieve database credentials
- Install the libSQL ActiveRecord gem
- Connect to a local or remote Turso database
- Define and create models
- Perform basic CRUD operations
- Execute raw SQL queries
- Work with migrations
Retrieve database credentials
You will need an existing database to continue. If you don’t have one, create one.Get the database URL:Get the database authentication token:Assign credentials to the environment variables inside
.env.Connect
Create a Ruby file (e.g.,
database.rb) to set up the database connection:Embedded Replicas
Embedded Replicas
Local only
Local only
Remote only
Remote only
In-memory
In-memory
Create and execute a migration
Create a migration file (e.g., Execute the migration:
001_create_products.rb):