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

Ticket #6030 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

[PATCH] fix acts_as_nested_set to work with STI classes

Reported by: josh@hasmanythrough.com Assigned to: David
Priority: normal Milestone: 1.x
Component: ActiveRecord Version:
Severity: normal Keywords:
Cc:

Description

Small change to acts_as_nested_set to allow it to work with STI classes. The old code explicitly uses the class of the object to interact with records, which is a problem for STI. If the object is a subclass it will miss superclass records. All this patch does is use the class's base_class instead of the class itself. Includes tests, test classes and fixtures.

Attachments

nested_set_sti_fix.diff (5.9 kB) - added by anonymous on 09/05/06 01:31:52.
STI fix for acts_as_nested_set
nested_set_sti_fix.2.diff (5.9 kB) - added by hasmanyjosh on 01/11/07 23:43:24.
STI fix for acts_as_nested_set (minor formatting fix since last version)

Change History

09/05/06 01:31:52 changed by anonymous

  • attachment nested_set_sti_fix.diff added.

STI fix for acts_as_nested_set

01/11/07 23:43:24 changed by hasmanyjosh

  • attachment nested_set_sti_fix.2.diff added.

STI fix for acts_as_nested_set (minor formatting fix since last version)

01/12/07 05:33:14 changed by bitsweat

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

(In [5889]) acts_as_nested_set works with single-table inheritance. Closes #6030.

01/12/07 05:36:45 changed by bitsweat

(In [5890]) Merge [5889] from trunk. References #6030.