Deprecate update_attribute #6739

Merged
merged 1 commit into from Jun 14, 2012

Projects

None yet

2 participants

@steveklabnik
Ruby on Rails member

Historically, update_attribute and update_attributes are similar, but
with one big difference: update_attribute does not run validations.
These two methods are really easy to confuse given their similar
names. Therefore, update_attribute is being deprecated in favor of
update_column, and will be removed in Rails 4.

See the discussion on rails-core here:
https://groups.google.com/d/topic/rubyonrails-core/BWPUTK7WvYA/discussion

@fxn fxn was assigned Jun 14, 2012
@fxn
Ruby on Rails member

I think the deprecation message should warn a little about the differences. Something like "use update_column if you do not need mass-assignment protection, callbacks, or touching updated_at, otherwise switch to update_attributes"... something in that line.

@steveklabnik steveklabnik Deprecate update_attribute.
Historically, update_attribute and update_attributes are similar, but
with one big difference: update_attribute does not run validations.
These two methods are really easy to confuse given their similar
names. Therefore, update_attribute is being deprecated in favor of
update_column, and will be removed in Rails 4.

See the discussion on rails-core here:
https://groups.google.com/d/topic/rubyonrails-core/BWPUTK7WvYA/discussion
b081f6b
@steveklabnik
Ruby on Rails member

Added in a better message, also silenced warnings from the tests.

@fxn fxn merged commit 63bcfbb into rails:3-2-stable Jun 14, 2012
@andyw8 andyw8 added a commit to andyw8/vim-snippets that referenced this pull request Feb 7, 2016
@andyw8 andyw8 Use `update` rather than `update_attributes
`update_attributes` is deprecated:
rails/rails#6739
16e922e
@SenZhangAI SenZhangAI added a commit to SenZhangAI/vim-snippets that referenced this pull request Mar 1, 2016
@andyw8 andyw8 Use `update` rather than `update_attributes
`update_attributes` is deprecated:
rails/rails#6739
035dd85
@shanzi shanzi pushed a commit to shanzi/vim-snippets that referenced this pull request Apr 12, 2016
@andyw8 andyw8 Use `update` rather than `update_attributes
`update_attributes` is deprecated:
rails/rails#6739
d7f4dd1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment