product_attr_config.rb 873 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. class ProductAttrConfig < ActiveRecord::Base
  2. has_paper_trail
  3. self.table_name = 'product_attr_configs'
  4. has_ancestry
  5. has_many :products, :foreign_key => :category_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 [:product_id,:attr_key_id]
  17. field :id
  18. field :product_id
  19. field :attr_key_id
  20. field :type
  21. end
  22. show do
  23. field :id
  24. field :product_id
  25. field :attr_key_id
  26. field :type
  27. end
  28. edit do
  29. field :product_id
  30. field :attr_key_id
  31. field :type
  32. end
  33. end
  34. end