A very simple example of DDD's repository pattern in Ruby.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db/migrate
lib/tasks
script
spec
.env
.env.test
.gitignore
.rspec
.rubocop.yml
.ruby-version
Gemfile
Gemfile.lock
README.md
Rakefile

README.md

RepositoriesExample

A very small example of DDD's repository pattern in Ruby.

It separates the responsibility of persistence and business rules, avoiding fat models.

In big applications, those concerns should be separated.

Layers

  • Entities: Business objects (without any persistence rule or DB acccess - PORO)
  • Repositories: Responsible to communicate with data sources and to convert the resulting info into business entities
    • DTOs: Responsible to connect to the DB and to have the persistence rules
    • Mappers: Responsible to map business entities into DTOs and vice-versa

Console

$ script/console