<commit_before># frozen_string_literal: true

class PingController < ApplicationController
  before_action :postgres_connected!
  after_action :verify_authorized, except: %i[index]

  def index
    render json: {
      message: 'Pong',
      timenow_in_time_zone____: DateTime.now.in_time_zone.to_i,
      timenow_without_timezone: DateTime.now.to_i,
    }
  end

  private

  def postgres_connected!
    # any unhandled exception leads to a HTTP 500 response.
    ApplicationRecord.establish_connection
    ApplicationRecord.connection
    raise ActiveRecord::ConnectionNotEstablished unless ApplicationRecord.connected?
  end
end
<commit_msg>Execute SQL statement in ping controller<commit_after># frozen_string_literal: true

class PingController < ApplicationController
  before_action :postgres_connected!
  after_action :verify_authorized, except: %i[index]

  def index
    render json: {
      message: 'Pong',
      timenow_in_time_zone____: DateTime.now.in_time_zone.to_i,
      timenow_without_timezone: DateTime.now.to_i,
    }
  end

  private

  def postgres_connected!
    # any unhandled exception leads to a HTTP 500 response.
    return if ApplicationRecord.connection.execute('SELECT 1 as result').first['result'] == 1

    raise ActiveRecord::ConnectionNotEstablished
  end
end

{'fraction_non_alphanumeric': 0.06702619414483821, 'fraction_numerical': 0.0061633281972265025, 'mean_word_length': 4.435146443514644, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7300358', 'n_tokens_mistral': 397, 'n_tokens_neox': 379, 'n_words': 94}