2011-03-18 1 views
0

기사에는 많은 저자, 편집자, 번역자 등이 있습니다. 모든 클래스 Person. 조인 모델을 생성 할 수 있습니까? 또는이 경우 솔루션은 수동으로 각 조인 모델을 작성하는 것입니다.Datamapper 다 대다 관계

class Article 
    include DataMapper::Resource 

    property :id, Serial 

    property :published_date, Date 
    property :status, Enum[ :pending, :accepted, :declined, :modified, :new ], :default => :new 
    property :visible, Boolean, :default => false 

    timestamps :at 

    has n, :authors, 'Person', :through => Resource 
end 


class Person 

    include DataMapper::Resource 

    property :id, Serial 

    property :name, String 
    property :about, Text 
    property :gender, Enum[ :male, :female ] 
    property :birthday, Date 

    timestamps :at 

    has n, :articles, :through => Resource 
end 

답변

0

불가능한 것처럼 보입니다. 오직 수동 모델 생성.