From: Marnen Laibow-Koser Date: 2009-05-27T13:05:38+09:00 Subject: Re: How to access variables from within class definition eggman2001 wrote: > 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? Of course you can't see @var from within the class definition if you set it outside. Remember that @variables are instance variables, and are scoped to the class definition. If you can explain where you're trying to set @var, perhaps we can come up with an alternative approach. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.