1

考虑以下模型:

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 关系。

谢谢!

乔纳森

4

1 回答 1

0

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

于 2011-01-21T10:02:31.220 回答