lib/rom/repository.rb in rom-repository-5.2.1 vs lib/rom/repository.rb in rom-repository-5.2.2
- old
+ new
@@ -130,12 +130,25 @@
# end
#
# user
# # nil
#
+ # @example with automatic savepoints
+ # user = transaction(auto_savepoint: true) do
+ # create(changeset(name: 'Jane'))
+ #
+ # transaction do |t|
+ # update(changeset(name: 'John'))
+ # t.rollback!
+ # end
+ # end
+ #
+ # user
+ # # => #<ROM::Struct::User id=1 name="Jane">
+ #
# @api public
- def transaction(&block)
- container.gateways[:default].transaction(&block)
+ def transaction(*args, &block)
+ container.gateways[:default].transaction(*args, &block)
end
# Return a string representation of a repository object
#
# @return [String]