Sha256: 7b2e7e4b718dd2e76aaf5ea07384ec3041064c2638fe4fd4c3b43ce368a90e66

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

module RailsPgExtras::Web
  class ActionsController < RailsPgExtras::Web::ApplicationController
    def kill_all
      run(:kill_all)
    end

    def pg_stat_statements_reset
      run(:pg_stat_statements_reset)
    end

    def add_extensions
      run(:add_extensions)
    end

    private

    def run(action)
      begin
        RailsPgExtras.run_query(query_name: action, in_format: :raw)
        redirect_to root_path, notice: "Successfully ran #{action}"
      rescue ActiveRecord::StatementInvalid => e
        redirect_to root_path, alert: "Error: #{e.message}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-pg-extras-4.1.0 app/controllers/rails_pg_extras/web/actions_controller.rb
rails-pg-extras-4.0.1 app/controllers/rails_pg_extras/web/actions_controller.rb