Open lukeredpath opened 8 years ago
It would seem to me that this can be resolved by calling normalize_with_option
before the asserts in the initialize
method. Given that :with
options are to simply a pointer to some defaults, it makes sense that these defaults be included in the asserts rather than the option pointing to them.
πππ
Trying to use :from with :with raises an error that using any other option with :from doesn't make any sense.
Doesn't it?
I want to authorise my models using Pundit. I want to do this by calling
authorize
- I don't care how the model was loaded.An easy way of doing this would be to use decorate:
The pattern is common enough I'd probably want to wrap it up isn an exposure config:
Now I can just do:
Great! Now I have a singleton resource I'd like to load as an association from the logged in user:
But I want it authorised too:
But this doesn't work as I can't use with and from together.
I can't do this either:
I can only do this:
But now I'm duplicating my call to
authorize
, something I'd prefer to keep encapsulated.Is there a reason to make these options mutually exclusive, just because sometimes they don't make sense to use together? Does the library need to be this restrictive?