-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
So I have the following models set up
class User include Mongoid::Document has_and_belongs_to_many :teams, autosave: true end class Team include Mongoid::Document has_and_belongs_to_many :users, autosave: true end
When I create a Team with team = Team.create users: [user] where user is a user object, everything works fine and my newly created team appears in user.teams. However, I’m getting data via POST so I only receive user ids, which leads me more or less to the following code: team = Team.create user_ids: [user.id.to_s] (production code looks of course different, user_ids are provided via params)
This also works as expected, except that the team is not stored in the user model. user.teams is still empty while team.users is saved correctly. Is this the desired behaviour?
I am using Mongoid 4 with Rails 4.
- related to
-
MONGOID-3090 referenced n-n relation incomplete tracking
- Closed