diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-25 23:33:08 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-02-25 23:33:08 +0000 |
commit | 5e99422d61cd690f24b10f540dafe218092283a3 (patch) | |
tree | 588c32efa3d76a3cd337d8a9f782d4a7c17e9aee /activerecord/lib/active_record/base.rb | |
parent | c350291ae7f9f0014d25575a1f0f13070c0b1c0c (diff) | |
download | rails-5e99422d61cd690f24b10f540dafe218092283a3.tar.gz rails-5e99422d61cd690f24b10f540dafe218092283a3.tar.bz2 rails-5e99422d61cd690f24b10f540dafe218092283a3.zip |
Updated docs (closes #3799) [ruby@bobsilva.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3651 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index dfa9bfab9d..ae15bc0c31 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -447,6 +447,16 @@ module ActiveRecord #:nodoc: # Finds the record from the passed +id+, instantly saves it with the passed +attributes+ (if the validation permits it), # and returns it. If the save fails under validations, the unsaved object is still returned. + # + # The arguments may also be given as arrays in which case the update method is called for each pair of +id+ and + # +attributes+ and an array of objects is returned. + # + # Example of updating one record: + # Person.update(15, {:user_name => 'Samuel', :group => 'expert'}) + # + # Example of updating multiple records: + # people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} } + # Person.update(people.keys, people.values) def update(id, attributes) if id.is_a?(Array) idx = -1 |