product_attr.rb 886 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class ProductAttr < ActiveRecord::Base
  2. has_paper_trail
  3. self.table_name = 'product_attrs'
  4. has_ancestry
  5. has_many :product_attr_keys, :foreign_key => :attr_key_id
  6. validates :name,presence:true
  7. rails_admin do
  8. navigation_label '商品管理'
  9. weight -250
  10. parent ProductAttrKey
  11. nestable_tree({
  12. position_field: :position,
  13. max_depth: 2
  14. })
  15. list do
  16. filters [:name,:ancestry,:position]
  17. field :id
  18. field :product_attr_key
  19. field :name
  20. field :recommend
  21. end
  22. show do
  23. field :id
  24. field :product_attr_key
  25. field :name
  26. field :recommend
  27. end
  28. edit do
  29. field :product_attr_key
  30. field :name
  31. field :recommend
  32. end
  33. end
  34. end