From: Heesob Park Date: 2009-05-27T13:44:16+09:00 Subject: Re: How to access variables from within class definition 2009/5/27 eggman2001 : > I've got something like: > > @var = 'brown' > > class Foo < ActiveRecord::Base >  set_table_name @var > end > > However, as the code is right now, I'm not able to access @var from > within the class definition. Can someone tell me how I can accomplish > this? > You can do it using eval like this: @var = 'brown' class Foo p eval('@var',TOPLEVEL_BINDING) end Regards, Park Heesob