Using the Active Admin structure, I can add a “Users” column that summarizes the score for a specific “club” by doing this:
ActiveAdmin.register Club do index do column 'Users' do |club| club.users.count end end end
Can I do this sorting somehow?
You can add a cache column to Usermodel belongs_to :club, and then make your index as follows:
User
belongs_to :club
ActiveAdmin.register Club do index do column 'Users', sortable: :users_count do |club| club.users.count end end end
Source: https://habr.com/ru/post/1526663/More articles:Как выполнить итеративную 2D-операцию в массиве 4D numpy - pythonHibernate CDI Injection - hibernateUsing an environment variable to run an external program - environment-variablesCamelCase vs snake_case vs dash-s in Ember.js application - ember.jsNfcAdapter.getDefaultAdapter returns null when an Android application is launched with the intent BOOT_COMPLETED - android"make install" - change output assignment for all builds - gccProblems with geocoding Google Maps: some coded URLs - phpCreating a new difference in the project between the application name and the module name - android-studioFree scales for fill color with geom_tile in ggplot2 - rHow to get properties from a dynamic object (anonymous type) using reflection? - genericsAll Articles