Use more naturally-sounding ensures

These match Basecamp and the existing predicate methods
This commit is contained in:
David Heinemeier Hansson
2025-10-29 13:33:34 +01:00
parent 1547cfd651
commit 60a429e463
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
class AdminController < ApplicationController
before_action :ensure_is_staff_member
before_action :ensure_staff
end
+2 -2
View File
@@ -1,10 +1,10 @@
module Authorization
private
def ensure_can_administer
def ensure_admin
head :forbidden unless Current.user.admin?
end
def ensure_is_staff_member
def ensure_staff
head :forbidden unless Current.user.staff?
end
end
@@ -1,5 +1,5 @@
class Webhooks::ActivationsController < ApplicationController
before_action :ensure_can_administer
before_action :ensure_admin
before_action :set_webhook
def create
+1 -1
View File
@@ -1,5 +1,5 @@
class WebhooksController < ApplicationController
before_action :ensure_can_administer
before_action :ensure_admin
before_action :set_collection
before_action :set_webhook, except: %i[ index new create ]