Question

Consider the following models:

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

Is is possible to use ActiveScaffold to administer this type of relationship? The ArtistEvent model exists to define a hbtm relationship with additional attribute of position.

Thanks!

Jonathan

Was it helpful?

Solution

yes. after all, ArtistEvent is yet another model - and active scaffold can operate on it as long as you have routes and controllers on the join model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top