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

Ticket #6450 (new defect)

Opened 3 years ago

Last modified 1 year ago

[PATCH] Support block association extensions in modules

Reported by: obrie Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: tiny association extension module tested
Cc: tys@tvg.ca, vzctl

Description

The following association fails when a block extension is specified:

module Widdle
  class Foo
    has_many :bars do
      def do_something
      end
    end
  end
end

In this case, create_extension_module generates the name Widdle::FooBarsAssociation and attempts to set that constant name in Object. However, it should rather generate the name FooBarsAssociation and set that constant name in the module Widdle. This patch addresses the issue.

Attachments

modulized_extensions.diff (1.0 kB) - added by obrie on 10/19/06 04:24:27.
Initial attempt.
modulized_extensions_with_tests.diff (2.9 kB) - added by obrie on 10/24/06 14:19:45.
Now with tests :)
modulized_extensions_with_tests.patch (3.0 kB) - added by tarmo on 12/29/07 03:12:51.
Rebased and updated for edge
modulized_extensions_with_tests_update.diff (2.8 kB) - added by vzctl on 01/31/08 05:56:19.
update for edge + counter cache fix

Change History

10/19/06 04:24:27 changed by obrie

  • attachment modulized_extensions.diff added.

Initial attempt.

10/19/06 05:14:15 changed by BobSilva

Please add tests.

10/19/06 05:39:54 changed by obrie

  • keywords changed from tiny association extension module to tiny association extension module tested.

10/24/06 14:19:45 changed by obrie

  • attachment modulized_extensions_with_tests.diff added.

Now with tests :)

02/18/07 21:51:12 changed by nzkoz

  • owner changed from David to nzkoz.
  • status changed from new to assigned.

I get an error trying to retrieve this patch, could you please upload it again. Not sure what happened there but it's definitely gone now :/

03/09/07 00:52:22 changed by obrie

The patch appears to be working now :)

06/14/07 00:41:16 changed by nerdrew

I'm having the same problem. Has this patch been merged into edge rails yet?

08/28/07 02:22:42 changed by tarmo

nerdrew, the patch has not been merged, but it does still apply to edge and the tests pass.

10/07/07 02:41:32 changed by nzkoz

  • owner changed from nzkoz to core.
  • status changed from assigned to new.

This patch needs reviewers

12/29/07 01:36:59 changed by fxn

#10642 and #9284 have been closed as duplicates of this one.

12/29/07 01:59:12 changed by tvongaza

  • cc set to tys@tvg.ca.

12/29/07 02:59:35 changed by chuyeow

The patch no longer applies to edge. Could you please rebase it?

12/29/07 03:12:51 changed by tarmo

  • attachment modulized_extensions_with_tests.patch added.

Rebased and updated for edge

01/26/08 12:37:44 changed by vzctl

  • cc changed from tys@tvg.ca to tys@tvg.ca, vzctl.

+1

01/31/08 05:56:19 changed by vzctl

  • attachment modulized_extensions_with_tests_update.diff added.

update for edge + counter cache fix