Class: SqlMonitor::ExplainSqlController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- SqlMonitor::ExplainSqlController
- Defined in:
- app/controllers/sql_monitor/explain_sql_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/sql_monitor/explain_sql_controller.rb', line 12 def index return not_found if Rails.env.production? data = ActiveRecord::Base.connection.execute("EXPLAIN #{params[:sql]}").first render json: { result: data.to_json } end |
#not_found ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/sql_monitor/explain_sql_controller.rb', line 6 def not_found respond_to do |format| format.any { head :not_found } end end |