Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change docs to use update instead of update_attributes

  • Loading branch information...
commit 1bb020063c1bad6cc6a2ad7a4635bfc31a308f65 1 parent 1f3a1fe
Amparo Luna + Guillermo Iguaran authored
View
4 actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -41,7 +41,7 @@ def initialize(param) # :nodoc:
# permitted.class # => ActionController::Parameters
# permitted.permitted? # => true
#
- # Person.first.update_attributes!(permitted)
+ # Person.first.update!(permitted)
# # => #<Person id: 1, name: "Francesco", age: 22, role: "user">
#
# It provides a +permit_all_parameters+ option that controls the top-level
@@ -329,7 +329,7 @@ def each_element(object)
# # into a 400 Bad Request reply.
# def update
# redirect_to current_account.people.find(params[:id]).tap { |person|
- # person.update_attributes!(person_params)
+ # person.update!(person_params)
# }
# end
#
View
8 actionpack/lib/action_view/helpers/form_helper.rb
@@ -101,9 +101,9 @@ module Helpers
# and generate HTML accordingly.
#
# The controller would receive the form data again in <tt>params[:person]</tt>, ready to be
- # passed to <tt>Person#update_attributes</tt>:
+ # passed to <tt>Person#update</tt>:
#
- # if @person.update_attributes(params[:person])
+ # if @person.update(params[:person])
# # success
# else
# # error handling
@@ -897,7 +897,7 @@ def text_area(object_name, method, options = {})
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# any mass-assignment idiom like
#
- # @invoice.update_attributes(params[:invoice])
+ # @invoice.update(params[:invoice])
#
# wouldn't update the flag.
#
@@ -1569,7 +1569,7 @@ def label(method, text = nil, options = {}, &block)
# invoice the user unchecks its check box, no +paid+ parameter is sent. So,
# any mass-assignment idiom like
#
- # @invoice.update_attributes(params[:invoice])
+ # @invoice.update(params[:invoice])
#
# wouldn't update the flag.
#
View
2  actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -130,7 +130,7 @@ module FormOptionsHelper
# the user deselects all roles from +role_ids+ multiple select box, no +role_ids+ parameter is sent. So,
# any mass-assignment idiom like
#
- # @user.update_attributes(params[:user])
+ # @user.update(params[:user])
#
# wouldn't update roles.
#
View
2  actionpack/lib/action_view/record_identifier.rb
@@ -17,7 +17,7 @@ module ActionView
# # controller
# def update
# post = Post.find(params[:id])
- # post.update_attributes(params[:post])
+ # post.update(params[:post])
#
# redirect_to(post) # Calls polymorphic_url(post) which in turn calls post_url(post)
# end
View
2  activerecord/examples/performance.rb
@@ -143,7 +143,7 @@ def self.email
end
x.report 'Resource#update' do
- Exhibit.first.update_attributes(:name => 'bob')
+ Exhibit.first.update(name: 'bob')
end
x.report 'Resource#destroy' do
View
2  activerecord/lib/active_record/nested_attributes.rb
@@ -58,7 +58,7 @@ class TooManyRecords < ActiveRecordError
# It also allows you to update the avatar through the member:
#
# params = { member: { avatar_attributes: { id: '2', icon: 'sad' } } }
- # member.update_attributes params[:member]
+ # member.update params[:member]
# member.avatar.icon # => 'sad'
#
# By default you will only be able to set and update attributes on the
View
2  activerecord/lib/active_record/persistence.rb
@@ -223,7 +223,7 @@ def update(attributes)
alias update_attributes update
- # Updates its receiver just like +update_attributes+ but calls <tt>save!</tt> instead
+ # Updates its receiver just like +update+ but calls <tt>save!</tt> instead
# of +save+, so an exception is raised if the record is invalid.
def update!(attributes)
# The following transaction covers any possible database side-effects of the
View
2  activesupport/lib/active_support/core_ext/hash/except.rb
@@ -2,7 +2,7 @@ class Hash
# Return a hash that includes everything but the given keys. This is useful for
# limiting a set of parameters to everything but a few known toggles:
#
- # @person.update_attributes(params[:person].except(:admin))
+ # @person.update(params[:person].except(:admin))
def except(*keys)
dup.except!(*keys)
end
Please sign in to comment.
Something went wrong with that request. Please try again.