请允许我说,我有两种模型<代码>Event和Person
。
许多人参加了一次活动,一个人也可以参加许多活动。
class Event < ActiveRecord::Base
has_and_belongs_to_many :people
end
class Person < ActiveRecord::Base
has_and_belongs_to_many :events
end
create_table "events_people", :id => false, :force => true do |t|
t.integer "event_id"
t.integer "person_id"
end
The problem is that an event is presented by one or many speakers
. So for a particular event
, we should have people
who attend that event and one or many speakers
who are, of course, people too.
我如何这样做? 谢谢。