# encoding:utf-8
class ArticleCat < ActiveRecord::Base
  has_paper_trail
  self.table_name = "article_cats"
  has_ancestry
  has_many :articles #, :dependent  => :destroy
  validates :name, presence: true

  rails_admin do
    navigation_label '文章栏目管理'
    weight -240
    nestable_tree({
                    position_field: :position,
                    max_depth: 2
    })
    
    list do
      filters [:name,:ancestry,:position]
      # include_all_fields
      field :id
      field :name
      field :position
      field :ancestry
      field :state
      field :articles
      # field :url
    end

    show do
      field :id
      field :name
      field :position
      field :ancestry
      field :state
      field :articles
    end

    edit do
      field :name
      field :state
      field :articles
    end
  end
end
