Skip to content

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

@cedricdekimpe

Description

@cedricdekimpe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions