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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. Mikael Björkegren wrote:> 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 > -- > Posted via http://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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 > -- > Posted via http://www.ruby-forum.com/. > > > >-- Nibirutech CTO Eric.Archangel MSN: archangel_hzm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org QQ: 996252 GMAIL: eric.archangel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org BLOG: http://blog.sina.com.cn/gameloft --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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�-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---