niaomingjian niaomingjian - 1 year ago 73
Ruby Question

Where can I find the document of present? method of ActiveRecord_Relation in Rails?

I'm new to Rails. When I'm studying Rails, I come across some methods which I don't know how to use.
Then I try to Google, but the outcome is not very good.

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download