good_job icon indicating copy to clipboard operation
good_job copied to clipboard

Pundit::NotDefinedError (unable to find policy `Admin::GoodJob::JobPolicy` for ) - version 2.13.0 and above

Open hiendinhngoc opened this issue 3 years ago • 2 comments

I got this error when upgrading from 2.11.3 to 2.13.0(and above), full log:

undit::NotDefinedError (unable to find policy `Admin::GoodJob::JobPolicy` for `[:admin, GoodJob::Job(id: uuid, queue_name: text, priority: integer, serialized_params: jsonb, scheduled_at: datetime, performed_at: datetime, finished_at: datetime, error: text, created_at: datetime, updated_at: datetime, active_job_id: uuid, concurrency_key: text, cron_key: text)]`):

I also noticed that the URL auto change: if I want to access like localhost:3000/admin/good_job(which runs fine with 2.12.0 and lower) to localhost:3000/admin/good_job/jobs

I use good_job in administrate with pundit, here is the method by which error occurred:

def authorize(record, query = {})
      super([:admin, record], **query)
    end

Ruby version: 3.0.2 Rails version: 6.1.0

hiendinhngoc avatar Jun 16 '22 16:06 hiendinhngoc

@hiendinhngoc thanks for opening the issue. That's weird.

GoodJob doesn't use Pundit, so I'm not sure why that authorize method would be triggered within GoodJob's Dashboard Engine. I'll have to dig into what's happening.

Here's the comparison between those versions in case something sticks out to you: https://github.com/bensheldon/good_job/compare/v2.11.3..v2.13.0

bensheldon avatar Jun 17 '22 00:06 bensheldon

That's weird.

Yes, it works normally until 2.13.0. Thanks for your link, need a little bit of time to investigate it.

hiendinhngoc avatar Jun 17 '22 01:06 hiendinhngoc

@hiendinhngoc Just looping back around on this. I'm curious if you ever discovered the problem?

bensheldon avatar Feb 06 '23 16:02 bensheldon