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

Ticket #11575 (new defect)

Opened 1 month ago

STI subclass that belongs to a different namespace than baseclass doesn't work as expected

Reported by: divoxx Assigned to: core
Priority: normal Milestone: 2.1
Component: ActiveRecord Version: edge
Severity: normal Keywords:
Cc:

Description

Currently, ActiveRecord only stores the "demodulized" name of the class making not possible to have subclasses in a different namespace of the baseclass.

To illustrate the issue:

class CollectionItem < ActiveRecord::Base; end
class ComicCollection::Item < CollectionItem; end

item = ComicCollection::Item.new
item.type # => 'Item'

item2 = CollectionItem.find(item.id) # raise an error because can't find class Item

This patch fixes this issue and add a configuration option to enable/disable it in order to keep back-compatibility.

Attachments

0001-Add-ActiveRecord-option-to-store-the-full-class-name.patch (5.5 kB) - added by divoxx on 04/11/08 15:47:22.

Change History

04/11/08 15:47:22 changed by divoxx

  • attachment 0001-Add-ActiveRecord-option-to-store-the-full-class-name.patch added.