Total Ruby noob, trying to figure something out. Looking at the docs
for ActiveRecord:Base, I see no mention of a "where" method in the
method list. Yet one is available. I think that "where" is part of
the ActiveRecord:QueryMethods.
So my question is twofold... first, how is "where" an available method
on my object subclassed from ActiveRecord:Base? Is QueryMethods a
mixin?
Second, looking at the documentation for ActiveRecordBase, how would I
know that "where" is available or how to access it? I realize it's
talked about in the text of the doc, but in general, how would I know
what methods are available to an object from a mixin?
So my question is twofold… first, how is “where” an available method
on my object subclassed from ActiveRecord:Base? Is QueryMethods a
mixin?
It’s inherited.
Second, looking at the documentation for ActiveRecordBase, how would I
know that “where” is available or how to access it? I realize it’s
talked about in the text of the doc, but in general, how would I know
what methods are available to an object from a mixin?
It’s inherited. If you are inheriting from ActiveRecord::Base it will be apart of your model. In every example in the documentation you are inheriting ActiveRecord::Base at the top of your class.
you'll see that none of the methods have any documentation. :-\
There is information on ARel queries here
and across several blog posts.
I wonder if documentation intentionally left out of the source to keep
it smaller? Anyone have some insight here? Just today I was
wondering where the controller request object methods are documented
(ex: request.path.. maybe it is being deprecated?)
Right, but the docs for ActiveRecord::Base show that it derives from
Object, so there's no "where" method in the chain anywhere. So I
don't think it's inherited.
Looking at the source code for ActiveRecord::Base, I do NOT see
"where" defined on ActiveRecord::Base. Nor is it defined in any
superclass (Object). Nor do I see it defined in the docs (under
methods).
So where the heck is it coming from? And if it's not defined in the
docs, how would I know about it?