def authenticate_by_cookie(authenticatable_class)
      key = cookie_name(authenticatable_class)
      authenticatable_id = cookies.encrypted[key]
      return unless authenticatable_id

      authenticatable_class.find_by(id: authenticatable_id)
    end
def authenticate_by_cookie(authenticatable_class)
      key = cookie_name(authenticatable_class)
      authenticatable_id = cookies.encrypted[key]
      return unless authenticatable_id

      authenticatable_class.find_by(id: authenticatable_id)
    end
Authenticate a record using cookies. Looks for a cookie corresponding to
 the _authenticatable_class_. If found try to find it in the database.
 @param authenticatable_class [ActiveRecord::Base] any Model connected to
   passwordless. (e.g - _User_ or _Admin_).
 @return [ActiveRecord::Base|nil] an instance of Model found by id stored
   in cookies.encrypted or nil if nothing is found.
 @see ModelHelpers#passwordless_with