i always worry if myown active_record callback conflicts with rails'' implemented corresponding one.i assume rails itself perhaps also use active_record callback.for example: #myown callback class Book < ActiveRecord::Base def after_save ... end end when i define the after_save for Book,i think perhaps this after_save has overrided rails itself''s implemented one,if so,i want to use both of them. is my consideration right? does rails use active_record callbacks? if it is true,how do i take care of myown''s and rails''. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 January 2011 03:08, Guo Yangguang <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> i always worry if myown active_record callback conflicts with rails'' > implemented corresponding one.i assume rails itself perhaps also use > active_record callback.for example: > > #myown callback > class Book < ActiveRecord::Base > def after_save > ... > > end > end > > > when i define the after_save for Book,i think perhaps this after_save > has overrided rails itself''s implemented one,if so,i want to use both of > them.I think what you want may be either class Book < ActiveRecord::Base after_save do # note, no def ..... end or class Book < ActiveRecord::Base after_save :my_after_save private def my_after_save ..... end Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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,colin.it seems the other two callback ways: handler class and observer are based on class declaration way,so that no override happens. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 January 2011 13:02, Guo Yangguang <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> thanks,colin.it seems the other two callback ways: handler class and > observer are based on class declaration way,so that no override happens.Please remember to quote the previous message and insert your comments inline so someone finding the conversation in the future will be able to follow the thread more easily. Thanks. It is not clear from your comment whether your problem is now solved. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 2, 3:08 am, Guo Yangguang <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> when i define the after_save for Book,i think perhaps this after_save > has overrided rails itself''s implemented one,if so,i want to use both of > them. > > is my consideration right? > does rails use active_record callbacks? if it is true,how do i take care > of myown''s and rails''.You don''t have to guess - you can check what rails does. As far as I can tell rails doesn''t use actual after_save etc. method and always uses the callback macros (after_save :foo etc.) Fred> > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.