Module: RubyLLM::Agents::Sortable Private

Extended by:
ActiveSupport::Concern
Included in:
ExecutionsController
Defined in:
app/controllers/concerns/ruby_llm/agents/sortable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Controller concern for sorting

Provides secure column sorting with whitelisted columns and direction validation. Prevents SQL injection by only allowing predefined sort columns.

Examples:

Using in a controller

include Sortable
@sort_params = parse_sort_params
result = paginate(scope, sort_params: @sort_params)

Constant Summary collapse

SORTABLE_COLUMNS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Whitelist of allowed sort columns mapped to their database column names Keys are the URL parameter values, values are the actual column names

{
  "agent_type" => "agent_type",
  "status" => "status",
  "model_id" => "model_id",
  "total_tokens" => "total_tokens",
  "total_cost" => "total_cost",
  "duration_ms" => "duration_ms",
  "created_at" => "created_at"
}.freeze
SORT_DIRECTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[asc desc].freeze
DEFAULT_SORT_COLUMN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"created_at"
DEFAULT_SORT_DIRECTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"desc"