search for: ubergoat

Displaying 2 results from an estimated 2 matches for "ubergoat".

2006 Feb 20
0
Object Finalizers help
...is bothering me as its evading my eye. I''m trying to set a callback on finalization of an object, ie: a finalizer set through a plugin to the model. Example In Plugin: def acts_as_goat class_eval do ObjectSpace.define_finalizer(self, Proc.new {self.conn.close} ) end end class UberGoat < ActiveRecord::Base acts_as_goat end Anyways, it seems to not be calling the finalizer? Is this the correct way to set a finalizer or am I going about it the wrong way. I need to close a socket connection _after_ the model is done being used, not necessarily a destroy, but out of scope...
2006 Feb 20
1
Object finalization help
...s one is bothering me as its evading my eye. I''m trying to set a callback on finalization of an object, ie: a finalizer set through a plugin to the model. Example In Plugin: def acts_as_goat class_eval do ObjectSpace.define_finalizer(self, lambda {self.conn.close} ) end end class UberGoat < ActiveRecord::Base acts_as_goat end Is this the correct way to set a finalizer or am I going about it the wrong way. I need to close a socket connection _after_ the model goes out of scope where GC usually happens. Do models get GC''d after a page is done loading? Thanks for an...