ソースを参照

增加商品属性定义

abiao 5 年 前
コミット
2f227d3092
共有2 個のファイルを変更した5 個の追加5 個の削除を含む
  1. 4 4
      app/models/product_attr_config.rb
  2. 1 1
      db/migrate/20200808124641_create_product_attrs.rb

+ 4 - 4
app/models/product_attr_config.rb

@@ -2,7 +2,7 @@ class ProductAttrConfig < ActiveRecord::Base
     has_paper_trail
     self.table_name = 'product_attr_configs'
     belongs_to :product_attr_key, :foreign_key => :attr_key_id
-    validates :type,presence:true
+    validates :size_type,presence:true
 
 
     def show_products
@@ -31,20 +31,20 @@ class ProductAttrConfig < ActiveRecord::Base
             field :product_id
             field :showProducts
             field :product_attr_key
-            field :type
+            field :size_type
         end
 
         show do
             field :id
             field :product_id
             field :product_attr_key
-            field :type
+            field :size_type
         end
 
         edit do
             field :product_id
             field :product_attr_key
-            field :type
+            field :size_type
         end
     end
 

+ 1 - 1
db/migrate/20200808124641_create_product_attrs.rb

@@ -30,7 +30,7 @@ class CreateProductAttrs < ActiveRecord::Migration
       # 规格ID
       t.column :attr_key_id, :integer, :limit => 8, :default => 0
       # 类型
-      t.column :type, :integer, :limit => 8, :default => 0
+      t.column :size_type, :integer, :limit => 8, :default => 0
       t.timestamps
     end