I have some functionality in a controller that I also want in a background job (ActiveJob). If the code was all equal in both, to avoid code duplication, I guess the proper way would be to move the shared functionality to the job, and execute the job (perform_now) from the controller?
But what if the code is not all equal, where i only need some of the methods in both, what would be the proper way to tho this? Would it be to move the shared code to
- public class methods in the job class, and call these from the controller?
- libs? (Or are they too general?)
- concerns?
- helpers?
What would be the proper way to share methods between a job and a controller? How do you guys do this?