Kaynağa Gözat

model add scope

abiao 5 yıl önce
ebeveyn
işleme
41ccf3b640
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      app/models/product.rb

+ 2 - 1
app/models/product.rb

@@ -123,7 +123,7 @@ class Product < ActiveRecord::Base
         end 
             #return ((rate*100).round.to_f/100).to_s + "%"
             # user= session_path(user_id)
-        return session_path()
+        return @user
     end
 
     rails_admin do 
@@ -131,6 +131,7 @@ class Product < ActiveRecord::Base
         weight -240
 
         list do
+            #authorize! :index, @user, :message=> 'Not authorized as an administrator.'
 
             scopes [:inactive]