From: "Simon Kröger" Date: 2006-04-12T06:46:55+09:00 Subject: Re: Equivalent of Java static code block in Ruby? Wes Gamble wrote: > 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. Maybe i don't understand but i think this is plain wrong: class A puts "Hello" end 100.times do a = A.new end #=> Hello cheers Simon