I have 3 models:
class Interest include Mongoid::Document has_many :user_hobby end class UserHobby include Mongoid::Document field :contacts, :type => Array belongs_to :interest, :foreign_key => "interest", inverse_of: nil belongs_to :interest, :foreign_key => "related_interests", inverse_of: nil embedded_in :user end class User include Mongoid::Document embeds_many :user_hobby end
I have to add a built-in relationship between user and user_hobby, but after that (in my tests) I have this error when I want to keep interest:
Mongoid :: Errors :: MixedRelations: referencing a (n) UserHobby document from an Interest document through a relational association is not allowed from the moment the UserHobby is inserted.
I watched this topic, but did not help me, but Mongoid :: Errors :: MixedRelations
Thanks.
eurek source share