- Improve exception handling for
#policy_scope
and#policy_scope!
. (#550)
No changes since beta1
- Add
policy_class
option toauthorize
to be able to override the policy. (#441) - Add
policy_scope_class
option toauthorize
to be able to override the policy scope. (#441) - Fix
param_key
issue when passed an array. (#529) - Only pass last element of "namespace array" to policy and scope. (#529)
- Allow specification of a
NilClassPolicy
. (#525) - Make sure
policy_class
override is called when passed an array. (#475) - Raise
InvalidConstructorError
if a policy or policy scope with an invalid constructor is called. (#462) - Use
action_name
instead ofparams[:action]
. (#419) - Add
pundit_params_for
method to make it easy to customize params fetching. (#502) - Return passed object from
#authorize
method to make chaining possible. (#385)
- Can retrieve policies via an array of symbols/objects.
- Add autodetection of param key to
permitted_attributes
helper. - Hide some methods which should not be actions.
- Permitted attributes should be expanded.
- Generator uses
RSpec.describe
according to modern best practices.
- Fixed a regression where NotAuthorizedError could not be ininitialized with a string.
- Use
camelize
instead ofclassify
for symbol policies to prevent weird pluralizations.
- Caches policy scopes and policies.
- Explicitly setting the policy for the controller via
controller.policy = foo
has been removed. Instead usecontroller.policies[record] = foo
. - Explicitly setting the policy scope for the controller via
controller.policy_policy = foo
has been removed. Instead usecontroller.policy_scopes[scope] = foo
. - Add
permitted_attributes
helper to fetch attributes from policy. - Add
pundit_policy_authorized?
andpundit_policy_scoped?
methods. - Instance variables are prefixed to avoid collisions.
- Add
Pundit.authorize
method. - Add
skip_authorization
andskip_policy_scope
helpers. - Better errors when checking multiple permissions in RSpec tests.
- Better errors in case
nil
is passed topolicy
orpolicy_scope
. - Use
inspect
when printing object for better errors. - Dropped official support for Ruby 1.9.3
- Extend the default
ApplicationPolicy
with anApplicationPolicy::Scope
(#120) - Fix RSpec 3 deprecation warnings for built-in matchers (#162)
- Generate blank policy spec/test files for Rspec/MiniTest/Test::Unit in Rails (#138)
- Customizable error messages:
#query
,#record
and#policy
methods onPundit::NotAuthorizedError
(#114) - Raise a different
Pundit::AuthorizationNotPerformedError
whenauthorize
call is expected in controller action but missing (#109) - Update Rspec matchers for Rspec 3 (#124)
- Customize the user to be passed into policies:
pundit_user
(#42)