Execute SQL statement in ping controller
This commit is contained in:
@ -16,8 +16,8 @@ class PingController < ApplicationController
|
|||||||
|
|
||||||
def postgres_connected!
|
def postgres_connected!
|
||||||
# any unhandled exception leads to a HTTP 500 response.
|
# any unhandled exception leads to a HTTP 500 response.
|
||||||
ApplicationRecord.establish_connection
|
return if ApplicationRecord.connection.execute('SELECT 1 as result').first['result'] == 1
|
||||||
ApplicationRecord.connection
|
|
||||||
raise ActiveRecord::ConnectionNotEstablished unless ApplicationRecord.connected?
|
raise ActiveRecord::ConnectionNotEstablished
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user