Skip to content

Commit 945ea02

Browse files
committed
don't store a reference to the User class
The issue: `Kracken::Config` was storing a reference to the `User` class. In development, if Rails detects that an app's source has changed, it would reload the source (including the User class). This would leave `Kracken` with a reference to an old version of the `User` class. The (partial) fix: don't store a reference. When we need the class, get it via `::User` and don't store it in an instance variable. This wont solve the case where the app sets a custom `User` class, but none of our apps do this currently.
1 parent b4d62c9 commit 945ea02

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/kracken/config.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ class Config
33
attr_accessor :app_id, :app_secret
44
attr_writer :provider_url, :user_class
55

6+
def initialize
7+
@user_class = nil
8+
end
9+
610
def provider_url
711
@provider_url ||= PROVIDER_URL
812
end
913

1014
def user_class
11-
@user_class ||= ::User
15+
@user_class || ::User
1216
end
1317
end
1418
end

0 commit comments

Comments
 (0)