good_job
good_job copied to clipboard
Allow customisation of the dashboard controller parent class
Like you have:
GoodJob.active_record_parent_class = "ApplicationRecord"
Would be good to have similar for the dashboard:
GoodJob.dashboard_controller_parent_class = "ApplicationController"
Where we can control things like authentication more easily, for example we have a Admin::ApplicationController
which we have all the authentication already setup as hooks.
Let me know.
@ollym thanks for opening this issue. With experience, I think I regret the creation of GoodJob.active_record_parent_class = "ApplicationRecord"
:
- Sorbet hates it
- It scares me out when I have to think about autoloading, reloading and Rails initialization order.
I don't have plans to remove it, but the pattern I am thinking of more strongly recommending is configuring via an initializer. Which is less pretty, but I think more resilient from the perspective of Ruby and Rails:
# initializers/good_job.rb
ActiveSupport::Reloader.to_prepare do
# open up the class and put your behavior in it directly:
class GoodJob::BaseRecord # <-- probably rename this GoodJob::ApplicationRecord for consistency
# put behavior here
end
class GoodJob::ApplicationController
# put behavior here
end
end
But I haven't made a decision. I am not sure.
This was documented in #1082