Sha256: 5aeffc4ff186bfb241011a13c011818514f7f0c18a9372d47ddb0c3e4022d86d
Contents?: true
Size: 826 Bytes
Versions: 43
Compression:
Stored size: 826 Bytes
Contents
module RailsPgExtras::Web class ActionsController < RailsPgExtras::Web::ApplicationController before_action :validate_action! 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 validate_action! unless RailsPgExtras::Web.action_enabled?(action_name) render plain: "Action '#{action_name}' is not enabled!", status: :forbidden end end 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
43 entries across 43 versions & 1 rubygems