Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 标志N+;1在Rspec中使用项目符号的查询_Ruby On Rails_Ruby_Rspec - Fatal编程技术网

Ruby on rails 标志N+;1在Rspec中使用项目符号的查询

Ruby on rails 标志N+;1在Rspec中使用项目符号的查询,ruby-on-rails,ruby,rspec,Ruby On Rails,Ruby,Rspec,我试图标记N+1,并在代码中添加计数器缓存的位置,使用。但是手动检查N+1查询似乎非常痛苦,因此我尝试使用Bullet和Rspec,使用他们推荐的设置步骤: # config/environments/test.rb config.after_initialize do Bullet.enable = true Bullet.bullet_logger = true Bullet.raise = true # raise an error if n+1 query occurs en

我试图标记N+1,并在代码中添加计数器缓存的位置,使用。但是手动检查N+1查询似乎非常痛苦,因此我尝试使用Bullet和Rspec,使用他们推荐的设置步骤:

# config/environments/test.rb
config.after_initialize do
  Bullet.enable = true
  Bullet.bullet_logger = true
  Bullet.raise = true # raise an error if n+1 query occurs
end

# spec/spec_helper.rb
if Bullet.enable?
  config.before(:each) do
    Bullet.start_request
  end

  config.after(:each) do
    Bullet.perform_out_of_channel_notifications if Bullet.notification?
    Bullet.end_request
  end
end

但是当我运行规范时,似乎在规范本身而不是应用程序中标记N+1查询。你知道是否有可能实现我想要的吗?

这实际上是gem中的一个bug,请关注这里的问题,发表评论并投票以获得更快的解决方案:

我在创业板回购协议中对此进行了发行: