2010-04-16 53 views
1

考虑以下型号:是否可以通过ActiveScaffold实现has_many :: through?

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模型存在用于定义与位置的附加属性的hbtm关系。

谢谢!

乔纳森

回答

0

是的。毕竟,ArtistEvent是另一种模式 - 只要在连接模型中有路线和控制器,活动脚手架就可以对其进行操作。