2010-04-16 5 views
1

는 다음과 같은 모델을 고려has_many, : through를 ActiveScaffold로 구현할 수 있습니까?

class Artist < ActiveRecord::Base 
    has_many :artist_events 
    has_many :events, :through => :artist_events 
end 

class Event < ActiveRecord::Base 
    has_many :artist_events 
    has_many :artists, :through => :artist_events, :order => 'artist_events.position' 
end 

class ArtistEvent < ActiveRecord::Base 
    default_scope :order => 'position' 
    belongs_to :artist 
    belongs_to :event 
    acts_as_list :scope => :artist 
end 

는 이러한 형태의 관계를 관리하는 ActiveScaffold를 사용할 수 있습니까? ArtistEvent 모델은 position 속성을 추가로 사용하여 hbtm 관계를 정의합니다.

감사합니다.

조나단

답변

0

예. 결국 ArtistEvent는 또 다른 모델이며 조인 모델에 경로와 컨트롤러가있는 한 활성 스캐 폴드에서 작업 할 수 있습니다.

관련 문제