Rick Olson wrote:
Perhaps plugins shouldn't be defining those methods, and instead use
the callback class methods:

class Foo < AR::Base
  before_save :do_this_one_last_thing

  protected
  def do_this_one_last_thing
  end
end

Otherwise, this could cause issues for someone overwriting a parent's
callback, expecting to override it completely.
Well thats what the plugins _are_ doing in a mix-in form.

 class_eval do
   before_save :something
 end

acts_as_auditable sets before_save :something to -> Parent
acts_as_ldapable set before_save :something_else to -> Child
:something to-> Parent becomes ignored instead of calling the parent as well...

before_save is a callback for the observer, but it is still a method, so you will always override it, unless you call super on it. In one way this is proper behavior, but it begs the question, what if we need to do more than one different thing before or after a save and they are different between types in a single table inheritance scheme.

Either the design meant to make callbacks overrideable via inheritance, or missed a tiny detail in implementation.

--
--
Adam Ballai <[EMAIL PROTECTED]>
Integrum Technologies, LLC
Phone: +1 602 792 1270 x 104
Mobile: +1 602 373 3072

begin:vcard
fn:Adam Ballai
n:Ballai;Adam
org:Integrum Technologies
adr:;;290 E. El Prado Court;Chandler;AZ;85225;United States of America
email;internet:[EMAIL PROTECTED]
title:Software Engineer
tel;work:602 792 1270
tel;fax:602 288 4111
tel;home:480 575 1708
tel;cell:602 373 3072
note:If you are unable to contact Adam through his main email, try [EMAIL PROTECTED]
x-mozilla-html:FALSE
url:http://www.integrumtech.com
version:2.1
end:vcard

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to