johan2
(johan)
1
Example:
class User < ActiveRecord::Base
end
class Member < User
has_one :blog, :as => :blogable
end
class Blog < ActiveRecrod::Base
belongs_to :blogable, :polymorphic => true
end
The member.blog.blogable_type is 'User'.
Does anybody know the reasoning for using the base_class instead of the
class name of the object
johan wrote:
Example:
class User < ActiveRecord::Base
end
class Member < User
has_one :blog, :as => :blogable
end
class Blog < ActiveRecrod::Base
belongs_to :blogable, :polymorphic => true
end
The member.blog.blogable_type is 'User'.
Does anybody know the reasoning for using the base_class instead of the
class name of the object
The STI/Polymorphic thing is a bit of a mess at the moment, as I
understand it. This recent documentation patch:
http://dev.rubyonrails.org/changeset/5259
contains some info that might help you for now.
Chris