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

+ 5 - 1
app/models/product.rb

@@ -121,6 +121,7 @@ class Product < ActiveRecord::Base
         if self.buy_price != 0 && self.price != 0
         if self.buy_price != 0 && self.price != 0
             rate = (( self.price.to_f - self.buy_price.to_f )/self.buy_price.to_f)*100
             rate = (( self.price.to_f - self.buy_price.to_f )/self.buy_price.to_f)*100
         end
         end
+
         return rate
         return rate
     end
     end
 
 
@@ -129,8 +130,11 @@ class Product < ActiveRecord::Base
         weight -240
         weight -240
 
 
         list do
         list do
+            current_user.id
+            if current_user.id==1
+                scopes [:inactive]
+            end
 
 
-            scopes [:inactive]
             filters [:id,:detail,:status,:name]
             filters [:id,:detail,:status,:name]
 
 
             field :id
             field :id