4
如何通过与Mongoid和mongodb的关系来实现has_many:?
使用Rails指南中的修改示例,如何使用mongoid为关系“ has_many:through”关联建模? 挑战在于,mongoid不像ActiveRecord那样支持has_many:through。 # doctor checking out patient class Physician < ActiveRecord::Base has_many :appointments has_many :patients, :through => :appointments has_many :meeting_notes, :through => :appointments end # notes taken during the appointment class MeetingNote < ActiveRecord::Base has_many :appointments has_many :patients, :through => :appointments has_many :physicians, :through => :appointments end # the …