Permalink
Browse files

transactions as class methods

  • Loading branch information...
1 parent dc091b0 commit c04b243fcf3fa7ba54d9c7b2c1fa7b6ffa49d46a felix committed with Jeremy Nicoll Mar 29, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/dm-is-awesome_set.rb
View
6 lib/dm-is-awesome_set.rb
@@ -157,7 +157,7 @@ module InstanceMethods
# @see move_without_saving
def move(vector)
- transaction do
+ get_class.transaction do
move_without_saving(vector)
save!
end
@@ -249,7 +249,7 @@ def destroy
# Trigger all the before :destroy methods
sads.each { |sad| before_methods.each { |bf| sad.send(bf) } }
# dup is called here because destroy! likes to clear out the array, understandably.
- transaction do
+ get_class.transaction do
sads.dup.destroy!
adjust_gap!(full_set, lft, -(rgt - lft + 1))
end
@@ -260,7 +260,7 @@ def destroy
# Same as @destroy, but does not run the hooks
def destroy!
sad = self_and_descendants
- transaction do
+ get_class.transaction do
sad.dup.destroy!
adjust_gap!(full_set, lft, -(rgt - lft + 1))
end

0 comments on commit c04b243

Please sign in to comment.