Add scope providing_styles
to UserRole
(#29286)
This commit is contained in:
parent
5d9d0d174a
commit
785e2f9399
2 changed files with 4 additions and 1 deletions
|
@ -97,6 +97,9 @@ class UserRole < ApplicationRecord
|
|||
before_validation :set_position
|
||||
|
||||
scope :assignable, -> { where.not(id: EVERYONE_ROLE_ID).order(position: :asc) }
|
||||
scope :highlighted, -> { where(highlighted: true) }
|
||||
scope :with_color, -> { where.not(color: [nil, '']) }
|
||||
scope :providing_styles, -> { highlighted.with_color }
|
||||
|
||||
has_many :users, inverse_of: :role, foreign_key: 'role_id', dependent: :nullify
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue