2
我使用Mongoid作爲數據庫,並且我有兩個模型,如下所示。我無法斷言has_many和belongs_to的關係。我可以在MiniTest中聲明這種關係。has_many和belongs_to在使用Mongoid的MiniTest中聲明
Event.rb
class Event
include Schizo::Data
include Mongoid::Document
field :name
field :start_at
field :finish_at
field :status
field :location
has_many :participations
end
Participation.rb
class Participation
include Mongoid::Document
belongs_to :event
belongs_to :participant
end