Displaying 1 result from an estimated 1 matches for "ownerless".
2006 Jul 19
0
Clearing dependent collections
I have a user model that owns messages :
class User < ActiveRecord::Base
has_many :messages , :dependent => :nullify
end
I''m using nullify so that when the user is deleted, the messages
continue to exist - they''re just marked as being ownerless.
However, calling user.messages.clear actually deletes all his
messages, which I was a little surprised at. I would have expected
it to just set the user_id on all his messages to null, given I''m not
using :dependent => :destroy/:delete.
Is this intentional? Is there an equiva...