Heya guys,

This 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 any help.

--
--
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to