Deprecate update_attribute #6739

Merged
merged 1 commit into from Jun 14, 2012

Conversation

Projects
None yet
2 participants
@steveklabnik
Member

steveklabnik commented Jun 14, 2012

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

@ghost ghost assigned fxn Jun 14, 2012

@fxn

This comment has been minimized.

Show comment
Hide comment
@fxn

fxn Jun 14, 2012

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.

Member

fxn commented Jun 14, 2012

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.

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
@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jun 14, 2012

Member

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

Member

steveklabnik commented Jun 14, 2012

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

fxn added a commit that referenced this pull request Jun 14, 2012

@fxn fxn merged commit 63bcfbb into rails:3-2-stable Jun 14, 2012

@rynr rynr referenced this pull request in geekq/workflow Dec 24, 2012

Closed

Use of update_attributes in recent commit #57

andyw8 added a commit to andyw8/vim-snippets that referenced this pull request Feb 7, 2016

SenZhangAI added a commit to SenZhangAI/vim-snippets that referenced this pull request Mar 1, 2016

shanzi pushed a commit to shanzi/vim-snippets that referenced this pull request Apr 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment