Rails 3 nested forms with has_many :through, entry in join table dosen't get deleted after update
- by Hadi S.
Hi,
i have a 'User' model which has a has_many relationship to a 'Number' model through a join table 'user_number' model.
I use
accepts_nested_attributes_for :numbers, :allow_destroy = true
in the 'User' model. Everything works fine except that whenever i delete a number from a user in the edit form,
the associated number is deleted correctly in the 'number' table, but not the entry in the 'user_number' join table.
In the update controller action i only use this:
...
if @user.update_attributes(params[:user])
...
How can i force rails to also delete the associated entry in the join table?