I'm pretty new with Rails and I have a problem with the following policies (using Pundit): I'd like to compare two objects: @record
and @foo
, as you can see here:
class BarPolicy < ApplicationPolicy
def show?
@record.foo_id == @foo
end
end
I don't reach to find a good way to pass a second parameter to pundit methods (@foo).
I'd like to do something like:
class BarsController < ApplicationController
def test
authorize bar, @foo, :show? # Throws ArgumentError
...
end
end
But the Pundit authorize method allows only two parameters. Is there a way to solve this issue?
Thanks!