Validations & Callbacks on different events in Ruby ⚓️

Rishi Pithadiya
1 min readApr 21, 2019

--

Validations

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

Callback

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:

Found this post useful? please click the 👏 button and share to help others find it! Feel free to leave a comment below.

--

--

Rishi Pithadiya

Finding happiness in words, food, places & untold stories ✌🏼 rishi.tips