product_attr.rb 887 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class ProductAttr < ActiveRecord::Base
  2. has_paper_trail
  3. self.table_name = 'product_attrs'
  4. belongs_to :product_attr_key, :foreign_key => :attr_key_id
  5. validates :name,:product_attr_key,presence:true
  6. rails_admin do
  7. navigation_label '商品管理'
  8. weight -250
  9. parent ProductAttrKey
  10. nestable_tree({
  11. position_field: :position,
  12. max_depth: 2
  13. })
  14. list do
  15. filters [:name,:product_attr_key]
  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