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

Ticket #10668 (closed defect: fixed)

Opened 6 months ago

Last modified 5 months ago

Remove useless code from AssociationProxy

Reported by: danger Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: minor Keywords: verified
Cc:

Description

At the beginning of AssociationProxy there's an attr_reader set. It's then immediately removed.

    class AssociationProxy #:nodoc:
      attr_reader :reflection # <= defines a 'reflection' method
      alias_method :proxy_respond_to?, :respond_to?
      alias_method :proxy_extend, :extend
      delegate :to_param, :to => :proxy_target
      # The following line removes the 'reflection' method
      instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|proxy_)/ }

The attached patch just takes out the attr_reader :reflection.

Attachments

remove_useless_attr_reader_from_association_proxy.diff (0.6 kB) - added by danger on 01/02/08 06:04:26.

Change History

01/02/08 06:04:26 changed by danger

  • attachment remove_useless_attr_reader_from_association_proxy.diff added.

01/03/08 01:03:46 changed by lotswholetime

+1

01/03/08 05:32:48 changed by evolving_jerk

+1

01/12/08 08:34:14 changed by railsjitsu

Lol, this is the kind of thing tunnel coding causes. You are there to fix a particular problem and don't see the forest for the trees so to speak. Been there myself :)

+1

01/12/08 14:56:28 changed by lotswholetime

  • keywords set to verified.

01/26/08 08:33:51 changed by nzkoz

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

(In [8737]) Remove dead attr_reader from association proxy. Closes #10668 [danger]