Allright then, in my update
method of the ad_user
controller, before the update_attributes
I added:
old_device_ids = @ad_user.device_ids
the after the update_attributes
I added:
(old_device_ids - AdUser.find(params[:id]).device_ids).each do |device|
Device.find(device).update_attributes(:ad_user_id => 1)
end
I had already done that earlier, but I wanted to find a proper "Rails way" of doing it.