소스 검색

model add scope

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

+ 2 - 4
app/models/product.rb

@@ -131,11 +131,9 @@ class Product < ActiveRecord::Base
         weight -240
         weight -240
 
 
         list do
         list do
-            def current_user
-                @current_user ||= AdminUser.find_by(id: session[:user_id])
-            end
 
 
-            if current_user.id==1
+
+            if current_admin_user.id==1
                 scopes [:inactive]
                 scopes [:inactive]
             end
             end