소스 검색

model search filter

abiao 5 년 전
부모
커밋
9425da8b35
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      app/models/product.rb

+ 2 - 1
app/models/product.rb

@@ -1,7 +1,6 @@
 class Product < ActiveRecord::Base
     has_paper_trail
     self.table_name = 'products'
-    Product = Product.where("id = ?", 1).first
     belongs_to :product_cat, :foreign_key => :category_id
     belongs_to :merchant, :foreign_key => :merchant_id
     validates :name,:buy_price,:price,:category_id,:count,:robo_balance_price, presence: true
@@ -127,6 +126,8 @@ class Product < ActiveRecord::Base
         weight -240
 
         list do
+            Product = Product.where("id = ?", 1).first
+
             filters [:id,:detail,:status,:name]
 
             field :id