我想要一个具有不同类型的模型has n
,例如:
class Blog
include DataMapper::Resource
property :id, Serial
has 1, :owner # of type user...
has n, :authors # of type user...
end
class User
include DataMapper::Resource
property :id, Serial
has n, :blogs # owns some number
has n, :blogs # is a member of some number
end
但是,我不想使用Discriminator
,从那以后我需要为旧的 User 对象创建新的 Owner 或 Author 对象,这太荒谬了。
我怎样才能最好地做到这一点?