The ActiveSupport library now has a little nugget worth mentioning – a metaclass accessor available everywhere as metaclass.
Not sure what a metaclass (or singleton class, or eigen class) is? Let Ola explain it to you.
Leave a response
Dave Thomas also does a great job of explaining the metaclass in his screencasts: http://www.pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming
Thanks for the link Richard Dave does a great job at explaining it, he is spot on!
I’m sorry to talk of another article in this one but the comments are closed in the other one.
I just wan’t to say that in the article about activeResource custom methods the last example is either wrong or outdated.
In fact the good “find” method should be
Person.find(:all, :from => :managers)
There is not a lot of resources about ActiveResource out there so that an outdated example means lot of pain for a beginner, so I think it would be great to update this one.
PS : Feel free to move or delete this comment ;)
Ads from Ruby Row