How do the AR singleton methods actually do there magic?

Hey all,

Ive been looking at the AR source code and wondering something. There is
heavy use of (for example)

class Base
class << self
#Â definitions

Now, I can see that this is how we get our nice syntax for model
validations and so forth - but what I dont get is how that actually
works behind the scences.

I found this post
detailing what that syntax means in detail, and I get that. But what
confuses me, is how if the validations are class methods, are they
validating instances of that class? What is actually going on behind the

If anyone can shed any light on this I would be very grateful



Watch the MetaProgramming - Extending Ruby for Fun and Profit screencast
Dave T…

Check out my site, there is a screencast on Include Vs
Extend that is also related.

On Dec 21, 2007 4:50 PM, Tim P. [email protected]

Free Ruby Screencasts

Excellent resources - thanks Bala


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs