Memoize instance variable

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

View File

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