double_entry icon indicating copy to clipboard operation
double_entry copied to clipboard

ActiveRecord deprecation

Open saiqulhaq opened this issue 5 years ago • 6 comments

I got this deprecation warning when executed DoubleEntry::Validation::LineCheck.perform!

DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
deprecated without replacement. If the `throw` came from
`Timeout.timeout(duration)`, pass an exception class as a second
argument so it doesn't use `throw` to abort its block. This results
in the transaction being committed, but in the next release of Rails
it will raise and rollback.
 (called from restartable_transaction at lib/ruby/gems/2.5.0/bundler/gems/double_entry-4ee0d7f9707a/lib/active_record/locking_extensions.rb:10)

https://github.com/envato/double_entry/blob/4ee0d7f9707a84e0b43932a94187617d32e02618/lib/active_record/locking_extensions.rb#L10

I use newest rails

saiqulhaq avatar Jun 13 '20 20:06 saiqulhaq

What version of DoubleEntry? Have you tried master?

Edit: confirmed this occurs on master based on the commit hash referenced in the backtrace.

swrobel avatar Jun 19 '20 18:06 swrobel

@saiqulhaq could you post the full backtrace, if available, or better yet, a reproducible test case?

swrobel avatar Jun 29 '20 22:06 swrobel

this is the git commit ID 4ee0d7f9707a

this is the file lib/active_record/locking_extensions.rb:10

I use rails master

saiqulhaq avatar Jun 30 '20 04:06 saiqulhaq

I will post the full backtrace tonight

saiqulhaq avatar Jun 30 '20 04:06 saiqulhaq

@saiqulhaq ping!

swrobel avatar Jul 15 '20 14:07 swrobel

Sorry @swrobel for late response this is the rails console output

DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
deprecated without replacement. If the `throw` came from
`Timeout.timeout(duration)`, pass an exception class as a second
argument so it doesn't use `throw` to abort its block. This results
in the transaction being committed, but in the next release of Rails
it will raise and rollback.
 (called from restartable_transaction at ~/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/bundler/gems/double_entry-4ee0d7f9707a/lib/active_record/locking_extensions.rb:10)
  TRANSACTION (0.5ms)  COMMIT
  TRANSACTION (0.1ms)  BEGIN
  DoubleEntry::Validation::LineCheck Create (8.3ms)  INSERT INTO "double_entry_line_checks" ("last_line_id", "errors_found", "log", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["last_line_id"
, 30], ["errors_found", false], ["log", ""], ["created_at", "2020-10-01 15:27:16.537799"], ["updated_at", "2020-10-01 15:27:16.537799"]]
  TRANSACTION (0.7ms)  COMMIT
=> #<DoubleEntry::Validation::LineCheck:0x00007fd8f071d830
 id: 1,
 last_line_id: 30,
 errors_found: false,
 log: "",
 created_at: Thu, 01 Oct 2020 15:27:16.537799000 UTC +00:00,
 updated_at: Thu, 01 Oct 2020 15:27:16.537799000 UTC +00:00>
[2] pry(main)>

saiqulhaq avatar Oct 01 '20 15:10 saiqulhaq