Sort a table_for in rails activeadmin

后端 未结 3 893
谎友^
谎友^ 2021-02-19 15:52

In an active admin show page, I\'ve got two panels, the first being the primary record, the second being associated info (by has_many) so show looks like this:

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-19 16:20

    ActiveAdmin now supports table sorting.

    table_for ride.bookings.order('updated_at desc') do
      column :name
      column :created_at
    end
    

    This, thanks to Ryan Bates's screencast: http://railscasts.com/episodes/284-active-admin?view=asciicast

提交回复
热议问题