From: Austin Ziegler Date: 2005-03-30T05:30:04+09:00 Subject: Re: attr :? On Wed, 30 Mar 2005 05:03:48 +0900, B. K. Oxley (binkley) wrote: > Florian Gross wrote: > > class Meta > > def self.has_many(sym) > > ivar = :"@#{sym}" > > define_method(sym.to_sym) do > > new_value = instance_variable_get(ivar) || [] > > instance_variable_set(ivar, new_value) > > new_value > > end > > end > > end > What is the difference between these two approaches? Florian's will only work on Ruby 1.8 or later and avoids some of the concerns that people have around "eval". -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca