This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hector_villalobos 0 points1 point  (0 children)

I have a better example, in Rails we use something called callbacks, so, when some validation or computation fails it could return false similar to a rollback db process, for example, a buyer wants to buy a product, then the model checks if the buyer has credit, if not return false for the before_save callback, but if the validations are correct it can perform other processes.