product_attr_config.rb 844 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 -230
  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_id
  18. field :attr_key_id
  19. field :type
  20. end
  21. show do
  22. field :id
  23. field :product_id
  24. field :attr_key_id
  25. field :type
  26. end
  27. edit do
  28. field :product_id
  29. field :attr_key_id
  30. field :type
  31. end
  32. end
  33. end