Thanks Hemant. However, as I mentioned in my last reply, it is not clear to me what triggers the execution of a statement such as "sayfoo :rubyrocks" in your example. When the class is loaded, when an instance is created, ??? Thanks. P. Hemant Kumar wrote: > On Thu, 2007-01-11 at 13:01 +0900, Paul Smith wrote: >> > Hmm validates_presence_of method is not "outside any method" in class > Person actually. Most probably (i.e taking into account rails meta > magic), validates_presence_of is a class method, which is defined in > class ActiveRecord::Base. > > So, when Person class inherits ActiveRecord::Base class it also inherits > method validates_presence_of and above mentioned line invokes the method > with argument :first_name. > > class Foobar > def self.sayfoo arg > puts "You said #{arg}" > end > end > > class Baz < Foobar > sayfoo :rubyrocks > end > > Output #=> "You said rubyrocks" > > > Unlike C++, where you can have class or instance methods of a class(i.e > static or normal methods of class) defined outside class definition, in > Ruby its always inside class. -- Posted via http://www.ruby-forum.com/.