From 0bec8d7264c51cc87201fc8c1b6faec76c941ed5 Mon Sep 17 00:00:00 2001 From: Nick Campbell Date: Thu, 19 Dec 2019 11:00:51 +0000 Subject: [PATCH] Fix Ruby 2.7 deprecation warning for Proc.new Capturing the block implicitly using this mechanism is going to be removed in Ruby 3.0 [1], so we need to explicitly pass the block in future. This change is backwards-compatible with other Ruby versions, it's just slightly slower (~10x) [2]. [1]: https://bugs.ruby-lang.org/issues/10499 [2]: https://medium.com/@amliving/proc-new-trick-c1df16185599 --- lib/statesman/adapters/active_record.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/statesman/adapters/active_record.rb b/lib/statesman/adapters/active_record.rb index c98eadfb..6e848267 100644 --- a/lib/statesman/adapters/active_record.rb +++ b/lib/statesman/adapters/active_record.rb @@ -197,8 +197,8 @@ def with_updated_timestamp(params) end class ActiveRecordAfterCommitWrap - def initialize - @callback = Proc.new + def initialize(&block) + @callback = block @connection = ::ActiveRecord::Base.connection end