From e731d76d52f4a404b1c274fff49854bf59e8161c Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 19 Apr 2020 21:54:40 +0100 Subject: [PATCH] Update admin/announcements routes to use has_role? --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index b63596a9..a79b0092 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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