railsadminteam/rails_admin · warning

The sort_reverse configuration option is deprecated and has

Error message

The sort_reverse configuration option is deprecated and has no effect.

What it means

The list-section sort_reverse option (lib/rails_admin/config/sections/list.rb:57) used to flip the default sort direction of a model's list. In current RailsAdmin it is a deprecated stub that only prints this ActiveSupport::Deprecation warning; direction is instead derived from the sort_reverse URL parameter (MainController#get_sort_hash, app/controllers/rails_admin/main_controller.rb:78-79) combined with the per-field sort_reverse? option (lib/rails_admin/config/fields/base.rb:112, defaulting true for datetime/integer/bson_object_id fields so timestamps sort newest-first).

Source

Thrown at lib/rails_admin/config/sections/list.rb:58

        register_instance_option :scopes do
          []
        end

        register_instance_option :row_css_class do
          ''
        end

        register_deprecated_instance_option :sidescroll do
          ActiveSupport::Deprecation.warn('The sidescroll configuration option was removed, it is always enabled now.')
        end

        def fields_for_table
          visible_fields.partition(&:sticky?).flatten
        end

        register_deprecated_instance_option :sort_reverse do
          ActiveSupport::Deprecation.warn('The sort_reverse configuration option is deprecated and has no effect.')
        end
      end
    end
  end
end

View on GitHub (pinned to 0690a5e62f)

Solutions

  1. Delete the `sort_reverse` line from the list block — it does nothing.
  2. If you need a specific default direction, set it on the field instead: `field :created_at, :datetime do sort_reverse? false end` (per-field, still honored by get_sort_hash).
  3. If you need full control of the initial ordering, set `list { sort_by :my_column }` and let users toggle direction via the column headers (params[:sort_reverse]).

Example fix

# before (warns, no effect)
RailsAdmin.config do |config|
  config.model Post do
    list do
      sort_by :created_at
      sort_reverse false
    end
  end
end

# after: direction set per field via sort_reverse?
RailsAdmin.config do |config|
  config.model Post do
    list { sort_by :created_at }
    field :created_at, :datetime do
      sort_reverse? false # oldest first
    end
  end
end
Defensive patterns

Strategy: validation

Validate before calling

# Assert list config uses only live options and that direction is field-driven
RSpec.configure do |c|
  c.before { ActiveSupport::Deprecation.silenced = false }
end
# spec: expects no deprecation when loading the model's list section
expect { RailsAdmin.config(Player).list }.not_to output(/deprecated/).to_stdout_from_any_process

Prevention

When it happens

Trigger: A model config containing `list { sort_reverse true }` (or false). The warning fires when the model config loads, and the passed value has zero effect — the list sorts per the field's sort_reverse? default and the user's header-click toggles, exactly as if the line were absent.

Common situations: Old 2.x-era configs setting sort_reverse expecting oldest-first (or newest-first) listings that silently stopped working after upgrade; teams debugging 'my default sort direction changed after the rails_admin bump' while the leftover option still warns; spec suites with deprecations raised as errors.

Related errors


AI-assisted analysis of railsadminteam/rails_admin@0690a5e62f (2026-08-21). Data as JSON: /api/errors/c953091f8e5241f4. Report an issue: GitHub.