Closed Nerian closed 7 years ago
I always use the Proc rather than the method way of doing this....
If it's not causing you any issues, i'm going to leave as is, and take another look at this in the 3.0 branch.
Yes, that makes perfect sense. I ended up using the Proc too, but the Readme confused me because it gives this as an example:
# As a Custom Method
config.authorization_method = :my_authorization_method
def my_authorization_method(action, resource)
current_user.is?(:admin) || EffectivePunditPolicy.new(current_user, resource).send('#{action}?')
end
Given that the two methods have the same name, I assumed that they were related. Maybe we could just change the example to have authorize!
as the method name:
https://github.com/code-and-effect/effective_datatables/pull/34
Hi,
I have this code on the initializer:
And this in ApplicationController
But the method is being called without the two arguments, so I get
wrong number of arguments (given 0, expected 2)
for that method.Defining the method as
def datatable_authorization_method
removes the error.So perhaps there is a change to be done here: https://github.com/code-and-effect/effective_datatables/blob/master/lib/effective_datatables.rb#L25
I am not using Cancan or Pundit.