On Wed, 30 Mar 2005 02:57:58 +0900, Luke Renn <goseigen / comcast.net> wrote:
> the ActiveRecord code for a few minutes and it looks like they're just
> class methods, but I don't understand how ruby interprets it i guess.

You're absolutely correct that they're just class methods. In Ruby
(unlike many other languages) the code that defines a class is much
more than just a "definition". The code between "class Foo ... end" is
executed just like any other part of your program. Perhaps this simple
example using a global variable will help clear it up:

irb(main):001:0> $foo = 'bar'
=> "bar"
irb(main):002:0> $foo
=> "bar"
irb(main):003:0> class FooChanger
irb(main):004:1> $foo = 'baz'
irb(main):005:1> end
=> "baz"
irb(main):006:0> $foo
=> "baz"

-- 
Regards,
John Wilger

-----------
Alice came to a fork in the road. "Which road do I take?" she asked.
"Where do you want to go?" responded the Cheshire cat.
"I don't know," Alice answered.
"Then," said the cat, "it doesn't matter."
- Lewis Carrol, Alice in Wonderland