Как я могу ссылаться на один и тот же класс дважды (или несколько раз) внутри другого класса с помощью Mongoid?
class User
include Mongoid::Document
field :email
references_many :messages, :stored_as => :array #all messages where the user acts as a sender
references_many :messages, :stored_as => :array #all messages where the user acts as a receiver
end
class Message
include Mongoid::Document
field :Text
references_one :user #this should be the sender
references_one :user #this should be the receiver
end