lib/simple_auth/session.rb in simple_auth-3.1.0 vs lib/simple_auth/session.rb in simple_auth-3.1.1
- old
+ new
@@ -1,9 +1,13 @@
# frozen_string_literal: true
module SimpleAuth
class Session
+ def self.record_not_found_exceptions
+ @record_not_found_exceptions ||= []
+ end
+
def self.create(**kwargs)
new(**kwargs)
end
def initialize(scope:, session:, record: nil)
@@ -19,9 +23,11 @@
def record
return unless record_id_from_session
@record ||= GlobalID::Locator.locate(record_id_from_session)
+ rescue *Session.record_not_found_exceptions
+ nil
end
def record_key
:"#{@scope}_id"
end