# encoding:utf-8
class AdminRole < ActiveRecord::Base
  has_paper_trail
  has_and_belongs_to_many :admin_users, join_table: :admin_roles_admin_users
  has_and_belongs_to_many :admin_permissions, join_table: :admin_permissions_admin_roles

  validates :name, presence: true

  rails_admin do
    navigation_label '系统管理'
    weight -20
    
    #    parent User
    configure :admin_permissions do
      inverse_of :admin_roles
    end

    configure :admin_users do
      hide
    end

    list do
      filters [:name]
      field :id
      field :name
      field :admin_users
      field :admin_permissions
      field :description
      # field :created_at
      # field :updated_at
    end

    edit do
    end
  end
end
