Ops, forgot the patch url :) http://dev.rubyonrails.org/ticket/11575
On May 3, 2:06 pm, Rodrigo Kochenburger <[EMAIL PROTECTED]> wrote: > While working on a big project (>100 models) it was necessary to use > namespace to store the models and surprisingly it wasn't hard at all. > Looks like Rails is (almost) supporting full model namespaces out-of- > the-box. :) > > The one and only problem was with STI. If you have subclasses in a > different namespace than the baseclass then things will blow. Reason > being ActiveRecord doesn't store the full class name, it store the > "demodulized" version of it. > > For example: > > class CollectionItem < ActiveRecord::Base; end > class ComicCollection::Item < CollectionItem; end > > item = ComicCollection::Item.new > item.type # => 'Item' > > item2 = CollectionItem.find(item.id) # <- this would raise an error > because it would not find class Item > > I wrote a patch that add a configuration option > ActiveRecord::Base.store_full_sti_class (in order to keep back- > compatibility) that when enabled will store the full class name. > > I believe storing the demodulized name was a bad assumption made in > the early days of Rails. Applying this patch will not only allow > people to namespace their models but probably prevent some other > errors and bugs in the future. > > If you think this should be applied, please go ahead and add +1 in > there. > > Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---