Help understand bcrypt and ruby syntax

I’m learning rails, and ruby.
I was looking at this bcrypt tutorial and have some questions in mind.


class User < ActiveRecord::Base


  validates :password,
    :length => { :minimum => 5 }


What is



validates :password, :length => { :minimum => 5 }

called? Are they just a function call?

I was trying to read the source of bcrypt to see how the above validates links back to the source, but I couldn’t find anything on it.

What is the meaning of

validates_confirmation_of :password, if: ->{ password.present? }

in this line?

has_secure_password is a Rails method.(See: ) validates is also a Rails method.

Validates is a Rails method, so you won’t be finding anything in bcrypt. Have a look here:

This is a check to see if two passwords match. For example on a sign up form where you ask the user to create a password and, in a subsequent field, ask them to confirm their password.