README.md in prosopite-1.0.3 vs README.md in prosopite-1.0.4

- old
+ new

@@ -125,15 +125,16 @@ Prosopite auto-detection can be enabled on all controllers: ```ruby class ApplicationController < ActionController::Base unless Rails.env.production? - before_action do + around_action :n_plus_one_detection + + def n_plus_one_detection Prosopite.scan - end - - after_action do + yield + ensure Prosopite.finish end end end ``` @@ -199,9 +200,26 @@ ```ruby Prosopite.scan do <code to scan> end ``` + +## Pausing and resuming scans + +Scans can be paused: + +```ruby +Prosopite.scan +# <code to scan> +Prosopite.pause +# <code that has n+1s> +Prosopite.resume +# <code to scan> +Prosopite.finish +``` + +An example of when you might use this is if you are [testing Active Jobs inline](https://guides.rubyonrails.org/testing.html#testing-jobs), +and don't want to run Prosopite on background job code, just foreground app code. In that case you could write an [Active Job callback](https://edgeguides.rubyonrails.org/active_job_basics.html#callbacks) that pauses the scan while the job is running. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/charkost/prosopite.