product_attr.rb 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. field :status
  21. end
  22. show do
  23. field :id
  24. field :product_attr_key
  25. field :name
  26. field :recommend
  27. field :status
  28. end
  29. edit do
  30. field :product_attr_key
  31. field :name
  32. field :recommend
  33. field :status
  34. end
  35. end
  36. end