From 61750e874b129c3c7c6ad20692c3a031e6f4e790 Mon Sep 17 00:00:00 2001 From: Zoxc Date: Fri, 1 Jul 2011 11:35:58 +0200 Subject: [PATCH] Return affected resource count from adjust!. --- lib/dm-adjust/collection.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dm-adjust/collection.rb b/lib/dm-adjust/collection.rb index 810b37b..1e60ea7 100644 --- a/lib/dm-adjust/collection.rb +++ b/lib/dm-adjust/collection.rb @@ -17,7 +17,7 @@ def adjust(attributes = {}, reload = false) # # @api public def adjust!(attributes = {}, reload = false) - return true if attributes.empty? + return 0 if attributes.empty? reload_conditions = if reload model_key = model.key(repository.name) @@ -25,7 +25,7 @@ def adjust!(attributes = {}, reload = false) end adjust_attributes = adjust_attributes(attributes) - repository.adjust(adjust_attributes, self) + affected_resource_count = repository.adjust(adjust_attributes, self) if reload_conditions @query.clear @@ -33,7 +33,7 @@ def adjust!(attributes = {}, reload = false) self.reload end - true + affected_resource_count end private