Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11047 (closed enhancement: fixed)

Opened 7 months ago

Last modified 7 months ago

[PATCH] Do not clone objects in AR::Base#attributes

Reported by: juanjo.bazan Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: AR base attributes clone
Cc:

Description

ActiveRecord::Base#attributes returns a hash of all the attributes with clones of their objects as values. To do so Kernel#clone is called and it is an expensive method. If cloning is not necessary it can be removed to speed things up.

Attachments

do_not_clone_in_attributtes.diff (1.6 kB) - added by juanjo.bazan on 02/07/08 21:29:22.
Method Base#attributes rewrote to avoid cloning

Change History

02/07/08 21:29:22 changed by juanjo.bazan

  • attachment do_not_clone_in_attributtes.diff added.

Method Base#attributes rewrote to avoid cloning

02/07/08 21:29:47 changed by juanjo.bazan

  • type changed from defect to enhancement.
  • summary changed from Do not clone objects in AR::Base#attributes to [PATCH] Do not clone objects in AR::Base#attributes.

02/08/08 23:35:36 changed by nzkoz

  • status changed from new to closed.
  • resolution set to fixed.

(In [8824]) Avoid cloning in Base#attributes. Closes #11047 [juanjo.bazan]