edit authors, delete users, UI changes
This commit is contained in:
parent
e36cc36947
commit
ccb6e23960
19 changed files with 190 additions and 75 deletions
|
@ -10,10 +10,18 @@ class ApplicationController < ActionController::Base
|
|||
!current_user.nil?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def notices_from_errors(record)
|
||||
messages = record.errors.messages.map do |attribute, messages|
|
||||
messages.map { |message| "#{attribute} #{message}".capitalize }
|
||||
end
|
||||
messages.flatten
|
||||
end
|
||||
|
||||
def ensure_admin
|
||||
unless current_user&.admin?
|
||||
redirect_to '/welcome', notice: 'You are not allowed to perform this action'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue