On 3/1/06, Adam Ballai <[EMAIL PROTECTED]> wrote:
> The subject asks the question.
>
> Should child callbacks call their parents in STI design models?
> Right now they don't and it was causing a headache as we needed to audit
> in the parent(ie: acts_as_auditable) and another plugin the child,
> specific to the scope of only that class(ie: acts_as_ldapable).
>
> acts_as_ldapable binds to the same callbacks as auditable, before_save,
> after_save, etc.
>
> So basically the child overrided the parents callbacks and neglected to
> behave normally.
>
> I submitted this ticket and patch if its any use to extend this behavior
> to rails, it would be much appreciated.  Thanks.
>
> http://dev.rubyonrails.org/ticket/4036
>
> --
> --
> Adam Ballai <[EMAIL PROTECTED]>
> Integrum Technologies, LLC
> Phone: +1 602 792 1270 x 104
> Mobile: +1 602 373 3072

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.

--
Rick Olson
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to