Hi,

Currently polymorphic_type field always use the class name of parent
in case of STI.

For example,
=====
class Attachment < ActiveRecord::Base
  belongs_to :attachable, :polymorphic => :true
end

class Asset < ActiveRecord::Base
  has_one :attachment, :as => :attachable
end

class Photo < Asset
end

class Video < Asset
end
=====

Here, attachable_type will always have value "Asset" in all the case,
even for Photo and Video. In fact, it'll be "Asset" even if the
has_one association is defined in Photo/Video instead of Asset.

This feels like a bug but then I was told it's expected behavior. This
makes something like http://pastie.caboo.se/75480 impossible. Also, it
restricts the mining operations you can perform ( counting, grouping,
etc.).

It'd be great to know why it's designed this way. I had submitted a
patch anyways - http://dev.rubyonrails.org/ticket/8841

Thanks,
Pratik
-- 
http://m.onkey.org

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to