Credits: Google Images


They are used to ensure that only valid data is saved into your database. i.e. check user email presence, check email uniqueness etc.


They are methods that get called at certain moments of an object’s life cycle. With callbacks it is possible to write code that will run whenever an object is created, saved, updated, deleted, validated, or loaded from the database.

The following table gives idea about whether validation and callbacks are called or not on ruby object method: