Replies: 1 comment 6 replies
-
That's an interesting idea. Maybe, we should provide an ability to specify the default for the authorization context: authorize :auth, default: proc { AuthSingleton.instance }
# or with a method name
authorize :auth, default: :auth_from_singleton
def auth_from_singleton
AuthSingleton.instance
end The second option could be useful if you want to override the default handler in a subclass. WDYT? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Add the ability for authorize to accept a lambda as an authorization target would make it super flexible.
And could be used with custom middleware that uses a thread-isolated attributes singleton like that provided by
ActiveSupport::CurrentAttributes
Something like...
Feels like this could be implemented relatively easily by allowing an additional
proc
option when initializing authorization_targetsBeta Was this translation helpful? Give feedback.
All reactions