Memoize instance variable

This commit is contained in:
2025-05-28 18:39:48 +04:00
parent 5c8ffc2630
commit 55c63be9e2

View File

@@ -131,7 +131,7 @@ class User < ApplicationRecord
end end
def is_admin? def is_admin?
admin ||= if admin = Devise::LDAP::Adapter.get_ldap_param(self.cn, :admin) @admin ||= if admin = Devise::LDAP::Adapter.get_ldap_param(self.cn, :admin)
!!admin.first !!admin.first
else else
false false