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

+ 5 - 5
app/models/product.rb

@@ -120,12 +120,8 @@ class Product < ActiveRecord::Base
         rate = 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
-        end 
-            #return ((rate*100).round.to_f/100).to_s + "%"
-        mer=field :gross_interest_rate do
-            formatted_value{bindings[:view].current_admin_user.email}
         end
-        return mer
+        return ((rate*100).round.to_f/100).to_s + "%"
     end
 
     rails_admin do 
@@ -133,6 +129,10 @@ class Product < ActiveRecord::Base
         weight -240
 
         list do
+            mer=field :gross_interest_rate do
+                formatted_value{bindings[:view].current_admin_user.email}
+            end
+            puts mer
             # authorize! :index, @user, :message=> 'Not authorized as an administrator.'
 
             scopes [:inactive]