Thanks, I figured about the method_missing part, but how does Ruby
know when to use Array and when to use Article in this case.
They are both. The capacities of Array and Article are merged together.
def what?(anObject, aint = self)
puts (anObject.public_methods - aint.public_methods).sort
Call what?cat.articles, and it will probably report that articles is an
Array. Then call what?cat.articles, , and it might report a bunch of
methods that articles added to the array.
Better yet, how could I reproduce this behavior?
Look up Ruby metaprogramming, including the chapter called IIRC “write
with code” in the book /Rails Recipes/.
“Test Driven Ajax (on Rails)”