Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Unit of Work experiments
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
Gemfile.devtools
Guardfile
LICENSE.txt
README.md
Rakefile
unit_of_work.gemspec

README.md

Unit of Work Build Status

This is an experimental UnitOfWork for DataMapper 2 session. It'll be merged into dm-session when it's ready.

Mapper Interface

To make mappers work with the UoW we need following methods:

# Inserts the object
Mapper#insert(object)

# Prepares the object to be inserted
Mapper#prepare_for_insert(object)

# Updates the object
Mapper#update(object)

# Prepares object to be updated
Mapper#prepare_for_update(object)

# Deletes the object
Mapper#delete(object)

# Prepares the object to be deleted
Mapper#prepare_for_delete(object)

# Returns all parent objects loaded for the given object
Mapper#parent_objects(object)

# Returns all child objects loaded for the given object
Mapper#child_objects(object)

Usage

user = User.new

work = Session::Uow.new(mapper_registry)
work.register_insert(user)
work.flush
Something went wrong with that request. Please try again.