Open mugwump opened 15 years ago
Is anybody looking into this anyway?!
no. best bet is to make a failing test and fix it yourself; this project is in patch-accepting-mode only :-/
sorry, just wondering if this was the right place to ask these kind of questions. Meanwhile I just stopped trying to put my models into modules: That produces all kinds of nasty side-efffects, not only with has_many_polymorphs - so basically, this works as designed :)
I've got a patch that fixes this (more shortly).
The namespaced_models branch in my fork supports loading names-spaced models in has_many_polymorphs autoload.rb.
Here's the commit where it was added:
http://github.com/stepheneb/has_many_polymorphs/commit/b563f4d65faabc494c8dcef3d3d5c34d2bc2af20
I have the following situation:
class Housing::Kennel < ActiveRecord::Base has_many_polymorphs :guests, :from => [:dogs,:cats,_birds] end
class GuestKennel < ActiveRecord::Base belongs_to :kennel belongs_to :guest, :polymorphic => true end
class Pets::Dog < ActiveRecord::Base end
Which I cannot get to run: (ActiveRecord::Associations::PolymorphicError: Could not find a valid class for :guests_kennels (tried GuestsKennel). If it's namespaced, be sure to specify it as :"guests/guests_kennels" instead.) - the error-message varies, depending in which module Kennel, GuestsKennel, Dog are put.
In the end, putting all three classes in one module and adding this module with :namespace => :housingandpets solves this issue.
Is there a way to specifiy the module for all three particpiants (Kennel, GuestsKennel, Dog) independently from each other and put them into different modules?!
(and thx for hmp anyway, works great!)