Minor guard clause refactor (#576)
This commit is contained in:
parent
e2dbd7cfcc
commit
e407e1ff91
1 changed files with 2 additions and 3 deletions
|
|
@ -34,8 +34,7 @@ class Block < ApplicationRecord
|
|||
end
|
||||
|
||||
def permissions
|
||||
if !user || !user.has_role?(:super_admin)
|
||||
errors.add(:commentable_id, "is not valid.")
|
||||
end
|
||||
return if user&.has_role?(:super_admin)
|
||||
errors.add(:commentable_id, "is not valid.")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue