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)
|
def user_not_authorized(exception)
|
||||||
policy_name = exception.policy.class.to_s.underscore
|
policy_name = exception.policy.class.to_s.underscore
|
||||||
|
|
||||||
flash[:error] = I18n.t "pundit.#{policy_name}.#{exception.query}",
|
flash[:error] = t "#{policy_name}.#{exception.query}", scope: "pundit", default: :default
|
||||||
default: 'You cannot perform this action.'
|
|
||||||
redirect_to(request.referrer || root_path)
|
redirect_to(request.referrer || root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -376,6 +375,7 @@ end
|
||||||
```yaml
|
```yaml
|
||||||
en:
|
en:
|
||||||
pundit:
|
pundit:
|
||||||
|
default: 'You cannot perform this action.'
|
||||||
post_policy:
|
post_policy:
|
||||||
update?: 'You cannot edit this post!'
|
update?: 'You cannot edit this post!'
|
||||||
create?: 'You cannot create posts!'
|
create?: 'You cannot create posts!'
|
||||||
|
|
Loading…
Reference in a new issue