mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Update 18n sample to translate default
This commit is contained in:
parent
a96e1c7ad6
commit
c4717a74cb
1 changed files with 2 additions and 2 deletions
|
@ -366,8 +366,7 @@ class ApplicationController < ActionController::Base
|
|||
def user_not_authorized(exception)
|
||||
policy_name = exception.policy.class.to_s.underscore
|
||||
|
||||
flash[:error] = I18n.t "pundit.#{policy_name}.#{exception.query}",
|
||||
default: 'You cannot perform this action.'
|
||||
flash[:error] = t "#{policy_name}.#{exception.query}", scope: "pundit", default: :default
|
||||
redirect_to(request.referrer || root_path)
|
||||
end
|
||||
end
|
||||
|
@ -376,6 +375,7 @@ end
|
|||
```yaml
|
||||
en:
|
||||
pundit:
|
||||
default: 'You cannot perform this action.'
|
||||
post_policy:
|
||||
update?: 'You cannot edit this post!'
|
||||
create?: 'You cannot create posts!'
|
||||
|
|
Loading…
Reference in a new issue