Dependency

Hello!

My problem is my :dependent => :destroy do not call the destroy method.
Why is it so?
Any sugesstions.

class Comment
belongs_to :commentable, :polymorphic => true,
end

class Article
has_many :comments, :as => ‘commentable’, :dependent => :destroy
end

In my opinion:

If you call delete method, then it will not call destroy method,
if you call destroy method, it will call destroy method.

i.e.
Article.destroy

it is the discrepancy between delete and destroy method.

In my opinion:

If you call delete method, then it will not call destroy method,

if you call destroy method, it will call destroy method.

i.e.

Article.destroy

it is the discrepancy between delete and destroy method.

On Fri, May 16, 2008 at 4:24 PM, Mikael Björkegren <
[email protected]> wrote:

class Article
has_many :comments, :as => ‘commentable’, :dependent => :destroy
end

Posted via http://www.ruby-forum.com/.


Nibirutech CTO Eric.Archangel
MSN: [email protected]
QQ: 996252
GMAIL: [email protected]
BLOG: http://blog.sina.com.cn/gameloft

Thanks for your reply.
But it do not call my destroy method for Comment, but it removes it
from my database. ?

Eric.Archangel wrote:

In my opinion:

If you call delete method, then it will not call destroy method,
if you call destroy method, it will call destroy method.
Article.destroy�

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs