Class: MagicQuery::Rails::MagicQueryController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/magic_query/rails/controller.rb

Overview

Base controller for Magic Query endpoints. Provides a RESTful endpoint for generating SQL queries from natural language.

For detailed documentation, examples, and customization options, see CONTROLLER.md

Instance Method Summary collapse

Instance Method Details

#generateObject



13
14
15
16
17
18
19
20
# File 'lib/magic_query/rails/controller.rb', line 13

def generate
  if @user_input.blank?
    render json: { error: 'Query parameter is required' }, status: :bad_request
    return
  end

  generate_sql_with_error_handling
end