Procházet zdrojové kódy

增加商品搜索关键字

abiao před 4 roky
rodič
revize
e876447246

+ 36 - 0
app/models/commend_word.rb

@@ -0,0 +1,36 @@
+# encoding: utf-8
+class AdPosition < ActiveRecord::Base
+  has_paper_trail
+  self.table_name = "commend_words"
+  validates :title,presence: true
+
+  rails_admin do
+    navigation_label '广告渠道管理'
+    weight -500
+    list do
+      filters [:title]
+      field :id
+      field :title
+      field :sort
+      field :status
+      field :created_at
+      # field :updated_at
+    end
+    show do
+      field :id
+      field :title
+      field :sort
+      field :status
+      field :created_at
+      # field :updated_at
+    end
+    edit do
+      field :title
+      field :sort
+      field :status
+      field :remark    
+    end
+
+  end
+
+end

+ 13 - 0
config/locales/models/commend_word.yml

@@ -0,0 +1,13 @@
+zh-CN:
+  activerecord:
+    models:
+      commend_word: 搜索关键字推荐
+    attributes:
+      commend_word:
+        id: ID
+        title: 名称
+        sort: 排序
+        status: 是否启用
+        created_at: 创建时间
+        updated_at: 更新时间
+        

+ 24 - 0
db/migrate/20210913030458_create_commend_words.rb

@@ -0,0 +1,24 @@
+# encoding:utf-8
+# 提货信息表
+class CreateCommendWords < ActiveRecord::Migration
+  def up
+    create_table :commend_words do |t|
+
+      #排序
+      t.integer :sort
+      #名称
+      t.string :title
+      #是否启用
+      t.boolean :state, :default => false
+      t.timestamps
+    end
+    add_index  :commend_words, :title
+
+
+  end
+
+  def down
+    drop_table :commend_words
+
+  end
+end