浏览代码

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") }