Update admin/announcements routes to use has_role?

This commit is contained in:
Karina Kwiatek 2020-04-19 21:54:40 +01:00
parent 391f4a28ed
commit e731d76d52
1 changed files with 1 additions and 1 deletions

View File

@ -128,7 +128,7 @@ Rails.application.routes.draw do
match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1}
constraints ->(req) { req.env['warden'].authenticate?(scope: :user) &&
(req.env['warden'].user.admin?) } do
(req.env['warden'].user.has_role?(:administrator)) } do
match "/admin/announcements", to: "announcement#index", via: :get, as: :announcement_index
match "/admin/announcements", to: "announcement#create", via: :post, as: :announcement_create
match "/admin/announcements/new", to: "announcement#new", via: :get, as: :announcement_new