CanCan执行不需要的count(*)sql查询

时间:2013-03-14 13:15:27

标签: ruby-on-rails ruby cancan

ability.rb:

can :index, Product, Product.owned_by(user) do |obj|
  obj.owned_by?(user)
end

当我打电话可以吗?(:index,Product)CanCan发送

SELECT COUNT(*) FROM `products` WHERE ...

在导航栏中我有很多项目,而且每个项目都有?(:index,...)会减慢我的页面。

ability.rb有什么问题吗?

0 个答案:

没有答案
相关问题