Find methods that can be used on a model object

What steps do I take to find the methods that I can use of a model object?

For example: I need to know is the membership_agreement of this loan valid? How to set the record for this loan so that the membership_agreement valid question to true or false. I need to find the conditions that will make the membership_agreement valid state true or false. Then I need to be able to change the data in the model to reflect a true or false. I need to do this using the irb console since this is for testing purposes only. The test I need to run I need to control the state of the object by setting the data in the model.


I’m not sure I understood your question, is ‘membership_agreement’ a property of the ‘loan’ model or is it an associated model?

It is an associated model. There is a class MembershipAgreement that based on ActiveRecord.

You can use ActiveRecord validations to ensure the properties for the ‘membership_agreement’ are valid. After setting these validations you can use ‘@loan.membership_agreement.valid?’. You can read more about setting and asking validations in the api docs or on the rails guides. I’m sure you’ll be able to find more information on this easily by searching for ‘rails validations’, for instance.

Hope this helps :slight_smile:

Yes, That is very helpful. Thank you.