product_attr.rb 856 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 -240
  10. nestable_tree({
  11. position_field: :position,
  12. max_depth: 2
  13. })
  14. list do
  15. filters [:name,:ancestry,:position]
  16. field :id
  17. field :product_attr_key
  18. field :name
  19. field :recommend
  20. end
  21. show do
  22. field :id
  23. field :product_attr_key
  24. field :name
  25. field :recommend
  26. end
  27. edit do
  28. field :product_attr_key
  29. field :name
  30. field :recommend
  31. end
  32. end
  33. end