I’ve 2 models Profile & User and they have HABTM relationship.
class Vcprofile < ActiveRecord::Base
class Vcgbluser < ActiveRecord::Base
I’ve a screen designed in which i can assign one profile to so many
users(through list box).
Initially if i assign 2 users(say sam and rose) to the profile(say
profile1), an entry is made into the “profiles_users” mapping table.
@profile.users = @User (@user is a list of users selected)
But later when i open the same page and select two more users(say jack
and jil) for the same profile(profile1) and submit, the old two
entries(sam and rose) are delted from the mapping table(profiles_uses)
and these two entries are added.
Why does HABTM delete the old entries(sam and rose) when a new
assignment is made?
Can anyone help?
Thanks in advance.