For ActiveAdmin v0.6.0 I changed the monkey patch to something like this
# initializers/active_admin.rb module ActiveAdmin class ResourceController module DataAccess def apply_sorting(chain) params[:order] ||= active_admin_config.sort_order orders = [] params[:order].present? && params[:order].split(/\s*,\s*/).each do |fragment| fragment =~ /^([\w\_\.]+)_(desc|asc)$/ column = $1 order = $2 table = active_admin_config.resource_column_names.include?(column) ? active_admin_config.resource_table_name : nil table_column = (column =~ /\./) ? column : [table, active_admin_config.resource_quoted_column_name(column)].compact.join(".") orders << "#{table_column} #{order}" end if orders.empty? chain else chain.reorder(orders.shift).order(orders) end end end end end
In my case, I will use it as the following, since it is more natural for me:
config.sort_order = 'first_name_desc, last_name_asc'
Details taken from my gist https://gist.github.com/anhkind/5e9d849ebe4f3a452e31
source share