소스 검색

model add scope

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

+ 1 - 0
app/models/product.rb

@@ -2,6 +2,7 @@
 class Product < ActiveRecord::Base
     has_paper_trail
     self.table_name = 'products'
+    authorize! :index, @user, :message=> 'Not authorized as an administrator.'
 
     scope :active, -> { where(ptype: "cent_sale") }
     scope :inactive, -> { where(ptype: "direct_sale") }