mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +02:00
Created user admin scope
This commit is contained in:
parent
807c537f67
commit
0ad2fd5a1b
2 changed files with 3 additions and 1 deletions
|
@ -58,7 +58,7 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_admins
|
def notify_admins
|
||||||
admin_users_emails = User.all.select { |u| u.roles.include? 'admin' }.pluck(:email)
|
admin_users_emails = User.admin.pluck(:email)
|
||||||
|
|
||||||
return if admin_users_emails.empty?
|
return if admin_users_emails.empty?
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
has_many :actions, dependent: :restrict_with_exception
|
has_many :actions, dependent: :restrict_with_exception
|
||||||
|
|
||||||
|
scope :admin, -> { where("'admin' = ANY (roles)") }
|
||||||
|
|
||||||
attr_accessor :phone
|
attr_accessor :phone
|
||||||
|
|
||||||
self.ignored_columns = %w[legacy_id]
|
self.ignored_columns = %w[legacy_id]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue