abiao лет назад: 5
Родитель
Сommit
5126ea95f8
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      app/models/product_attr_config.rb

+ 4 - 3
app/models/product_attr_config.rb

@@ -15,6 +15,7 @@ class ProductAttrConfig < ActiveRecord::Base
         showProducts.each {|v| puts v}
         return showProducts
     end
+    PRODUCT_ENUM = show_products
     TYPE_ENUM = [["颜色","color"],["尺码","size"]]
     rails_admin do
         navigation_label '商品管理'
@@ -30,7 +31,7 @@ class ProductAttrConfig < ActiveRecord::Base
             field :id
             field :product_id, :enum do
                 enum do
-                    show_products
+                    PRODUCT_ENUM
                 end
             end
             field :product_attr_key
@@ -45,7 +46,7 @@ class ProductAttrConfig < ActiveRecord::Base
             field :id
             field :product_id, :enum do
                 enum do
-                    show_products
+                    PRODUCT_ENUM
                 end
             end
             field :product_attr_key
@@ -59,7 +60,7 @@ class ProductAttrConfig < ActiveRecord::Base
         edit do
             field :product_id, :enum do
                 enum do
-                    show_products
+                    PRODUCT_ENUM
                 end
             end
             field :product_attr_key