I would recmmend make a
def before_destroy
comments = Comment.find(:all,:conditions => "profile_id = " +
self.id.to_s )
comments.each { |c| c.destroy }
end
in the profile.rb
So in his lifespan he deletes all comments associated to him.
Cheers
Thomas
On Mar 5, 2:03 am, "[email protected]"
<[email protected]> wrote:
> Once I destroy a User I am able to make some destroy dependencies
> about what to clean up after him,
> but with comments it doesnt work, since they belong not to the user
> but the other guy where we left them.
>
> Speaking code:
> # Comments and Blogs
> has_many :comments, :as => :commentable, :order => 'created_at
> desc', :dependent => :destroy
> --> does delete the comments left on my profile BUT doesnt delete the
> comments i left on other peoples profiles.
>
> How can I delete all comments I made?
>
> Cheers
> Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Lovd by Less" 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/lovdbyless?hl=en
Who loves ya baby?
-~----------~----~----~----~------~----~------~--~---