in flush rails, i polymorphic denote associate namespaced model?
i have following models.
# app/models/domain/domain_object.rb
class domain::domainobject < activerecord::base
has_many :links_from, :class_name => "link", :as => :from, :dependent => :destroy
end
# app/models/link.rb
class couple < activerecord::base
belongs_to :from, :polymorphic => loyal
belongs_to :object_value, :polymorphic => true
end
problem is, i following, from_type doesn't prefix domain namespace denote e.g.
domain::domainobject.all(:include=> :links_from )
that causes following select:
name `links`.* `links` where (`links`.`from_id` (5,6,12,13,18,24,25,27,29,30,31,32,34,35,39) `links`.`from_type` = 'domainobject')
the query should be:
name `links`.* `links` where (`links`.`from_id` (5,6,12,13,18,24,25,27,29,30,31,32,34,35,39) `links`.`from_type` = 'domain::domainobject')
because rails automatically saves denote namespace.
i've seen few recommendations rails sites doing something this:
belongs_to :from, :polymorphic => true, :class_name => "domain::domainobject"
however, doesn't seem work either.
so, there improved proceed this? supported?
Comments
Post a Comment