This project is archived and is in readonly mode.
rename attributes= to merge_attributes
Reported by Dan Manges | January 11th, 2009 @ 01:30 AM | in 3.x
I think ActiveRecord::Base#attributes= should be renamed to merge_attributes. It's a more intuitive name. Especially because attributes= looks like a regular setter, people who are not familiar with the method assume that it replaces all the attributes, not that it merges them.
Comments and changes to this ticket
-
Pratik March 8th, 2009 @ 01:41 PM
- Assigned user set to Michael Koziarski
- State changed from new to incomplete
The old behaviour needs to be deprecated before this can be pushed.
Thanks !
-
Pratik March 9th, 2009 @ 09:59 AM
- State changed from incomplete to open
-
Mike Breen August 10th, 2009 @ 01:03 AM
- Tag changed from activerecord, patch to activerecord, bugmash, patch
+1 for the change but I have verified that the patch does not apply cleanly:
activerecord/../merge-attributes-rename-with-deprecation.diff:161: trailing whitespace.
activerecord/../merge-attributes-rename-with-deprecation.diff:232: trailing whitespace.
error: patch failed: activerecord/lib/active_record/base.rb:2749
error: activerecord/lib/active_record/base.rb: patch does not apply
error: patch failed: activerecord/lib/active_record/serializers/json_serializer.rb:80
error: activerecord/lib/active_record/serializers/json_serializer.rb: patch does not apply
error: patch failed: activerecord/test/cases/base_test.rb:1015
error: activerecord/test/cases/base_test.rb: patch does not apply -
Mike Breen August 10th, 2009 @ 01:14 AM
same for master:
error: patch failed: activerecord/lib/active_record/attribute_methods.rb:224
error: activerecord/lib/active_record/attribute_methods.rb: patch does not apply
error: patch failed: activerecord/lib/active_record/base.rb:2749
error: activerecord/lib/active_record/base.rb: patch does not apply
error: patch failed: activerecord/lib/active_record/serializers/json_serializer.rb:80
error: activerecord/lib/active_record/serializers/json_serializer.rb: patch does not apply
error: patch failed: activerecord/test/cases/attribute_methods_test.rb:274
error: activerecord/test/cases/attribute_methods_test.rb: patch does not apply
error: patch failed: activerecord/test/cases/base_test.rb:1015
error: activerecord/test/cases/base_test.rb: patch does not apply -
Rizwan Reza August 10th, 2009 @ 04:16 AM
not reproducible
The patch doesn't apply cleanly on master or 2-3-stable.
-
Jeremy Kemper August 10th, 2009 @ 04:23 AM
@foo.attributes = params[:foo]
is part of every Rails intro. Changing this should not be taken lightly. I agree that using a setter method than actually does an update is confusing, but I find the suggested replacement even more confusing. Perhaps@foo.assign params[:foo]
. -
Jeremy Kemper August 10th, 2009 @ 04:24 AM
- Tag changed from activerecord, bugmash, patch to activerecord, patch
Any patch of this nature is liable to get out-of-date quickly; no worries there.
I'm removing this ticket from bugmash consideration since it's a huge change that needs more consideration to move forward.
-
Santiago Pastorino February 2nd, 2011 @ 04:42 PM
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:42 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>