varvet / pundit

Minimal authorization through OO design and pure Ruby classes
MIT License
8.21k stars 624 forks source link

Add policy_class to permitted_attributes #789

Open hobbypunk90 opened 8 months ago

hobbypunk90 commented 8 months ago

Fixes #742 again 😅

Sorry, i cleaned my github a bit too fast.

Burgestrand commented 3 months ago

Hi! Thanks for the PR!

I posted a comment in the ol' issue https://github.com/varvet/pundit/issues/742#issuecomment-2026343020 about what I think we should probably do.

I'd rather avoid having to modify other methods when adding support for this, to avoid breaking existing code.

By adding a policy_class: nil parameter to permitted_attributes and only altering behaviour if that is passed we can probably add this feature without risking altering behaviour of existing code.