That's fine but I only want it executed ONCE the first time the class is loaded. I have a Rails application that creates a new INSTANCE of a controller class every time a certain URL is requested. All of the code that isn't in methods is being executed every time the instance is created. So do I have to guard my code to ensure that it's only executed once? Thanks, Wes Justin Collins wrote: > Wes Gamble wrote: >> then guard it so that it's only executed once? >> >> Thanks, >> Wes >> >> > Code placed within the class definition, but not in methods: > > irb(main):001:0> class A > irb(main):002:1> puts "Hello!" > irb(main):003:1> end > Hello! > => nil > > > Note how Hello! is output as soon as the class is parsed. I think this > is what you want...? > > -Justin -- Posted via http://www.ruby-forum.com/.