niaomingjian niaomingjian - 9 months ago 33
Ruby Question

Where can I find the document of `present?` method of ActiveRecord_Relation

I'm studying Rails and have come across some methods which I don't know how to use.

For example, I defined a model

. In the
, I defined
method. In this method, someone used the
I'm not sure what it is. So I want to know how the official site says about it.

Where can I find the explanation of this method.

Could you tell me the way to study methods like this?

Answer Source

To see where specific method is defined, you can check it as follows:

#=> #<Method: User(Object)#present?>

This means, that method present? is defined in class Object.

Then, when you have a name of the class where method is defined, you just open documentation (either Ruby or Rails) and search for the method you want to learn about in corresponding class.

In your case, here is documentation for present? method.