Как отсортировать атрибуты магазина с помощью активного администратора? - PullRequest
0 голосов
/ 28 февраля 2020

Как отсортировать метод доступа к атрибуту магазина и метод

То есть мне нужно, чтобы моя таблица сортировалась по : status,: another_email_id,: another_phone_number, в среднем

user.rb

class User < ApplicationRecord

    has_many :posts

    valivalidates :email , presence: true
    valivalidates :name , presence: true
    valivalidates :phone_number , presence: true
    store :extra_fields, accessors: [:status, :another_email_id, :another_phone_number]

   def average
       ((self.posts.count/Post.all.count)*100).round(2)
   end

end

admin / users.rb

ActiveAdmin.register User do

index do
    column :name
    column :email
    column :phone_number
    column :status
    column :another_phone_number
    column :another_email_id
    column "Average", &:average
end
...