If you want to reuse callback code for more than one object that Rails provides a way to write callback classes. All you have to do is pass a given callback queue an object that responds to the name of the callback and takes the model object as a parameter.
1 2 3 4 5 6 |
|
The behavior of MarkDeleted is stateless, so I added the callback as a class method.
1 2 3 |
|
1 2 3 |
|
So far so good, That’s it!!! See ya!!! :)