I'm using Rails 4.1 with mongoid 4.0 Currently, I have a relation 1-N
class Tenant
include Mongoid::Document
belongs_to :tenant, index: true
end
class Experience
include Mongoid::Document
has_many :experiences, dependent: :nullify
end
I want to change this relationship to a N-N. For that I change in both models to:
class Tenant
include Mongoid::Document
has_and_belongs_to_many :tenants, index:true
end
class Experience
include Mongoid::Document
has_and_belongs_to_many :tenants, index:true
end
But now I don't have the former data I had.