Can't Find ModelName With Id = 12345
Very often we use Callbacks to perform several actions after creation of a record. Also sometimes make a queue for SideKiq workers to work on. Let’s assume a model User.
1 2 3 4 5 6 7 8 9 10 |
|
and worker
1 2 3 4 5 6 7 |
|
But some times we get error like Can't find User with id = XX
. To avoid this –
1 2 3 4 5 6 7 8 9 10 |
|
This way there would be no error for Can't find User with id = XX
in any case. More details check Rails Best Practices.