Rails Active Admin as config.sort_order with 2 columns (1 column from association)

In Active Admin, I would like to know how to configure config.sort_order with two columns, where the first column comes from one model and the second column from a related model?

ActiveAdmin.register Race do menu parent: :races, :label => proc{ I18n.t('activerecord.models.races') } belongs_to :meeting, :optional => true #need to order by "meetings.date desc races.time desc" config.sort_order = "?" controller do def scoped_collection end_of_association_chain.includes(:meeting) end end end 
+4
source share
1 answer

config.sort_order will accept sorting across multiple fields, the format " field1_ (asc | desc), field2_ (asc | desc) " is maintained in the reverse order of compatibility.

Please check this link for reference. https://github.com/activeadmin/activeadmin/pull/2432 . This may solve your problem.

0
source

Source: https://habr.com/ru/post/1496833/


All Articles