Hi Everyone,

I'd like the comments that a user makes to remain in the db after the
user is deleted. This should be easy with CE's overriding features
that I've used many other times, right?

Here's what I've done, but it doesn't work, and I'm wondering if
anyone knows why?

I created app/models/user.rb to override specific things from the core
CE user.rb model. Here is my simple app/models/user.rb:

class User < ActiveRecord::Base

has_many :comments_as_author, :class_name => "Comment", :foreign_key
=> "user_id", :order => "created_at desc", :dependent => :nullify

end

For comparison, the user.rb file in the core CE models directory has a
very similar line:

has_many    :comments_as_author, :class_name =>
"Comment", :foreign_key => "user_id", :order => "created_at
desc", :dependent => :destroy

The only difference between the two is the :dependent action. As you
can see, I'm trying to override ":destroy" with ":nullify". But this
doesn't work: When I delete a user, all the user's comments are
deleted as well.

Please, any help is appreciated. Thanks,
Steve


-- 
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en.

Reply via email to