First off this is a Rails 3.2 app using Ruby 2.1.3p242 and Mongo 1.7.1
I have a User
model that has_many :host_clubs, :class_name => 'Club', :inverse_of => :host
which has the following field field :host_club_ids
since we are using Mongodb.
On the Club
models side the relationship is as follows:
belongs_to :host, :class_name => 'User', :inverse_of => :host_club
When I create a club I can see the relationship is set by calling the following:
user.host_clubs => [#<Club _id: 568c02c7e30a9939cf00002c, ect ect...]
so it is returning the clubs associated, but when I try user.host_club_ids
it returns => []
.
I dont get any errors when creating the club but I cannot figure out why it wont set the host_club_ids
field.
Here is the call used to create the club @club = @user.host_clubs.new(params[:club])
If anyone can point me in the right direction that would be great.
Aucun commentaire:
Enregistrer un commentaire