# encoding: utf-8
class AdminDepart < ActiveRecord::Base
  has_paper_trail
  self.table_name = "admin_departs"
  belongs_to :admin_user, :foreign_key => :admin_user_id
  belongs_to :depart_record, :foreign_key => :depart_record_id
  validates :depart_record_id,:admin_user_id,presence: true

  rails_admin do
    navigation_label '系统管理'
    weight -20
    parent AdminUser
    list do
      filters [:admin_user_id,:depart_record_id,:remark]
      field :id
      field :admin_user_id do
        filterable true
      end
      field :admin_user
      field :depart_record_id do
        filterable true
      end
      field :depart_record
      field :remark
      field :created_at
      field :updated_at
    end

    show do
      field :id
      field :admin_user_id do
        filterable true
      end
      field :admin_user
      field :depart_record_id do
        filterable true
      end
      field :depart_record
      field :remark
      field :created_at
      field :updated_at
    end

    edit do
      field :admin_user
      field :depart_record
      field :remark
    end
  end
end
