Trouble Moving application_job.rb to Pack: New File Generated with 'rails g job example' Command - Seeking Solution

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Message originally sent by slack user U71TN2WF04X

Hello :wave: I am moving my application_job.rb file to a pack, but when I run the command rails g job example a new app/jobs/application_job.rb is generated. Has anyone solved this? I tried writing a monkey patch for the JobsGenerator but with no success yet.

Message originally sent by slack user U71VEMF3PJI

~Not a perfect solution but - if you’re using the use packs gem, you can generate the job and then use the move command to put it in the right spot.~

Message originally sent by slack user U71VEMF3PJI

Oh apologies - I misread your question!

Message originally sent by slack user U71TN2WF04X

No problem :+1:

Message originally sent by slack user U712YWCKK8T

We did something similar for ViewComponents to have the generator put them under a pack. There’s a nice article on how to do that in general here https://wasabigeek.com/blog/dont-give-up-on-your-rails-generators/

Message originally sent by slack user U71TN2WF04X

Great thanks! :raised_hands: