Tom
Tom

Reputation: 2075

Where is this errors method defined and what can I reference to learn more in the Rails Api?

When looking at this code:

@user.errors.any?

Where is the errors method defined in Rails 3.2.3, or what should I be looking at in the API to understand it further?

Upvotes: 0

Views: 36

Answers (1)

Dave Newton
Dave Newton

Reputation: 160261

http://apidock.com/rails/ActiveModel/Errors

http://apidock.com/rails/ActiveResource/Errors

Don't know what @user is, although I assume it's an ActiveRecord model.

Depending on what information you're looking for it's often easier to use a tool like pry to "change directories" into a particular object or class. From there you can query the object to determine what methods are available, and you can often look at the source directly from within pry.

What kind of information are you looking for regarding errors specifically? IIRC it's just a hash.

Upvotes: 1

Related Questions