aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-19 16:21:55 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-19 16:21:55 +0000
commit69cb942d9b72d9a18f8d00c5887f2532bdda0a0f (patch)
tree309f72ad492f052ed7f8cf57b067bd618f59da60 /activerecord/lib/active_record/base.rb
parent88192b9b1be2bd0729073c899df42a789f264993 (diff)
downloadrails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.tar.gz
rails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.tar.bz2
rails-69cb942d9b72d9a18f8d00c5887f2532bdda0a0f.zip
Changed the interface on AbstractAdapter to require that adapters return the number of affected rows on delete and update operations. Added that Base.update_all and Base.delete_all return an integer of the number of affected rows #341
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 38002ad2a0..58a1ac5787 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -343,13 +343,13 @@ module ActiveRecord #:nodoc:
find(id).destroy
end
- # Updates all records with the SET-part of an SQL update statement in +updates+. A subset of the records can be selected
- # by specifying +conditions+. Example:
+ # Updates all records with the SET-part of an SQL update statement in +updates+ and returns an integer with the number of rows updates.
+ # A subset of the records can be selected by specifying +conditions+. Example:
# Billing.update_all "category = 'authorized', approved = 1", "author = 'David'"
def update_all(updates, conditions = nil)
sql = "UPDATE #{table_name} SET #{updates} "
add_conditions!(sql, conditions)
- connection.update(sql, "#{name} Update")
+ return connection.update(sql, "#{name} Update")
end
# Destroys the objects for all the records that matches the +condition+ by instantiating each object and calling