James Herdman
2007-Jul-23 18:34 UTC
[Ferret-talk] Acts_As_Ferret: disable_ferret and Callbacks
Does disable_ferret monkey with callbacks at all? I have a model in my application that has associated models which perform callbacks after their validation (they''re all instantiated around the same time). I recently added a conditional call to disable ferret provided a flag and I''m finding these callbacks aren''t quite working right. Here''s a code sample: class Model < ActiveRecord::Base has_one :associated_model # This model will fill in some fields upon it''s own validation def save_with_activation_handling! if active? # This part works self.activated_at = Time.now else disable_ferret :once self.activated_at = nil end save_without_activation_handling! end alias_method_chain :save!, :activation_handling end Any ideas? Thank you, James Herdman -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2007-Jul-25 09:36 UTC
[Ferret-talk] Acts_As_Ferret: disable_ferret and Callbacks
On Mon, Jul 23, 2007 at 08:34:31PM +0200, James Herdman wrote:> Does disable_ferret monkey with callbacks at all? I have a model in my > application that has associated models which perform callbacks after > their validation (they''re all instantiated around the same time). I > recently added a conditional call to disable ferret provided a flag and > I''m finding these callbacks aren''t quite working right.what exactly does this mean? Is Ferret not disabled, or are your callbacks never called? Jens -- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
James Herdman
2007-Jul-25 23:46 UTC
[Ferret-talk] Acts_As_Ferret: disable_ferret and Callbacks
Jens Kraemer wrote:> On Mon, Jul 23, 2007 at 08:34:31PM +0200, James Herdman wrote: >> Does disable_ferret monkey with callbacks at all? I have a model in my >> application that has associated models which perform callbacks after >> their validation (they''re all instantiated around the same time). I >> recently added a conditional call to disable ferret provided a flag and >> I''m finding these callbacks aren''t quite working right. > > what exactly does this mean? Is Ferret not disabled, or are your > callbacks never called?The callbacks weren''t firing. It doesn''t matter though. I''ve since approached the problem from a different angle. -- Posted via http://www.ruby-forum.com/.