Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rename attributes= to merge_attributes

#1729

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.

Reported by Dan Manges · January 11th, 2009 @ 01:30 AM

State: stale
Milestone: 3.x
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Pratik
    Pratik
    • 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 !

    March 8th, 2009 @ 01:41 PM

  2. Dan Manges
  3. Pratik
    Pratik
    • State changed from incomplete to open

    March 9th, 2009 @ 09:59 AM

  4. Mike Breen
    Mike Breen
    • 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

    August 10th, 2009 @ 01:03 AM

  5. Mike Breen
    Mike Breen

    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

    August 10th, 2009 @ 01:14 AM

  6. Rizwan Reza
    Rizwan Reza

    not reproducible

    The patch doesn't apply cleanly on master or 2-3-stable.

    August 10th, 2009 @ 04:16 AM

  7. Jeremy Kemper
    Jeremy Kemper

    @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].

    August 10th, 2009 @ 04:23 AM

  8. Jeremy Kemper
    Jeremy Kemper
    • 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.

    August 10th, 2009 @ 04:24 AM

  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  10. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 2nd, 2011 @ 04:42 PM

  11. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:42 PM