Skip to content

Commit c158898

Browse files
Merge pull request #843 from hiptest/fix-327-concern-cause-app-to-connect-to-db
Better implementation to test if connection to db is active
2 parents 9fdf831 + 3e8657f commit c158898

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)