Skip to content

Commit 3e8657f

Browse files
committed
Better implementation to test if connection to db is active
1 parent 6d764da commit 3e8657f

File tree

1 file changed

+1
-5
lines changed
  • app/models/devise_token_auth/concerns

1 file changed

+1
-5
lines changed

app/models/devise_token_auth/concerns/user.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ def tokens_has_json_column_type?
9999
end
100100

101101
def database_exists?
102-
ActiveRecord::Base.connection
103-
rescue ActiveRecord::NoDatabaseError
104-
false
105-
else
106-
true
102+
ActiveRecord::Base.connection_pool.with_connection { |con| con.active? } rescue false
107103
end
108104
end
109105

0 commit comments

Comments
 (0)