What is the purpose for creating callback in AR?

I have read active record callback in rails document, i have some doubt regarding callback, why have we to define callback and advantage of callback. and what is the ruby on rails open source project which can provide the basic knowladge about basic concept’s.

thanks

Callbacks 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 Active Record object is created, saved, updated, deleted, validated, or loaded from the database.

1 Like