Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate update_attribute #6739

Merged
merged 1 commit into from
Jun 14, 2012
Merged

Deprecate update_attribute #6739

merged 1 commit into from
Jun 14, 2012

Conversation

steveklabnik
Copy link
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

@ghost ghost assigned fxn Jun 14, 2012
@fxn
Copy link
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.

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
Copy link
Member Author

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
andyw8 added a commit to andyw8/vim-snippets that referenced this pull request Feb 7, 2016
SenZhangAI pushed 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants