Hanakai
  • Hanami

    Complete framework for building apps

    Dry

    Validation, types, functional patterns and more

    Rom

    Powerful and flexible persistence toolkit

  • Learn
  • Blog
  • Community
  • Sponsor

Projects

Hanami
Dry
Rom
  • Learn
  • Blog
  • Community
  • Sponsor

Rom

  1. Getting started
    1. Introduction
    2. Compared to ActiveRecord
    3. Core Concepts
    4. Installation
    5. Setup DSL
    6. Rails setup
    7. Glossary
  2. Core concepts
    1. Core concepts
    2. Relations
    3. Schemas
    4. Associations
    5. Combines
    6. Changesets
    7. Commands
    8. Structs
    9. Mappers
  3. Repositories
    1. Repositories
    2. Quick Start
    3. Reading Simple Objects
    4. Reading Aggregates
    5. Writing Aggregates
  4. Changesets
    1. Introduction
    2. Mapping
    3. Associations
  5. SQL
    1. SQL
    2. Relations
    3. Schemas
    4. Queries
    5. Attributes
    6. Associations
    7. Joins
    8. Transactions
    9. Migrations
    10. Advanced PostgreSQL support
  6. HTTP
    1. HTTP
  7. Factories
    1. Factories
  8. Advanced
    1. Advanced
    2. Explicit setup
    3. Build an adapter
  9. FAQ
    1. FAQ
  1. Getting started
    1. Introduction
    2. Compared to ActiveRecord
    3. Core Concepts
    4. Installation
    5. Setup DSL
    6. Rails setup
    7. Glossary
  2. Core concepts
    1. Core concepts
    2. Relations
    3. Schemas
    4. Associations
    5. Combines
    6. Changesets
    7. Commands
    8. Structs
    9. Mappers
  3. Repositories
    1. Repositories
    2. Quick Start
    3. Reading Simple Objects
    4. Reading Aggregates
    5. Writing Aggregates
  4. Changesets
    1. Introduction
    2. Mapping
    3. Associations
  5. SQL
    1. SQL
    2. Relations
    3. Schemas
    4. Queries
    5. Attributes
    6. Associations
    7. Joins
    8. Transactions
    9. Migrations
    10. Advanced PostgreSQL support
  6. HTTP
    1. HTTP
  7. Factories
    1. Factories
  8. Advanced
    1. Advanced
    2. Explicit setup
    3. Build an adapter
  9. FAQ
    1. FAQ
  1. Rom
  2. SQL
v5.0

Transactions

To use a transaction simply wrap an operation via Relation#transaction method:

# rollback happens when any error is raised
users.transaction do |t|
  users.command(:create).call(name: "jane")
end

# manual rollback
users.transaction do |t|
  users.command(:create).call(name: "Jane")
  t.rollback!
end

SQL Joins

SQL Migrations

  • Projects
    • Hanami
    • Dry
    • Rom
  • Learn
    • Hanami
    • Dry
    • Rom
  • Community
    • Code repos
    • Discussion forum
    • Chat room
    • AI policy
  • Blog
  • Conduct
  • Sponsor

Supported by