trestle-auth icon indicating copy to clipboard operation
trestle-auth copied to clipboard

undefined method `authorize?' for #<PlansAdmin::AdminController:0x00000000065450>

Open cedricdekimpe opened this issue 8 months ago • 4 comments

I try to use trestle-auth with the authorization branch with a very barebone Trestle resource :

# frozen_string_literal: true

Trestle.resource(:plans) do
  authorize_with pundit: PlanPolicy
end
# frozen_string_literal: true

class PlanPolicy < ApplicationPolicy
  def index?
    true
  end
end

But when I try to reache /admin/plans I got this error :

undefined method `authorize?' for #<PlansAdmin::AdminController:0x00000000065450>

I tried to track this down as far as I could and it seems that the Pundit policy is well taken into account by trestle-auth, and I couldn't find where this authorize? method would be called - I didn't even find any Google/GitHub/StackOverflow result with this exact method.

Would anyone have any idea for me to debug this?

Rails 7.1.3.2 Pundit : 2.2.0 Trestle : 0.9.9 Trestle Auth : trestle-auth-121cad6a8cb6

cedricdekimpe avatar Jun 11 '24 09:06 cedricdekimpe