envato / double_entry

A double-entry accounting system for Ruby applications.

Home Page:https://rubygems.org/gems/double_entry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ActiveRecord deprecation

saiqulhaq opened this issue · 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)

I use newest rails

What version of DoubleEntry? Have you tried master?

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

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

this is the git commit ID 4ee0d7f

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

I use rails master

I will post the full backtrace tonight

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)>