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

Account Scope initializer not compatible with Spring Preloader (for development)

jeffnappi opened this issue · comments

The account scope initialization using ActiveRecordScopeFactory currently takes a reference to the scoped class at startup. This is not compatible with the Rails Spring loader which provides a dramatic speedup during app development.

I understand that this may be by design, but I'd like to discuss potential workarounds at least for development.

I have resolved this for the moment by adding a Spring.after_fork hook in environments/development.rb:

Spring.after_fork do
  DoubleEntry.configure do |config|
    config.accounts = nil
    config.transfers = nil
  end
  load 'config/initializers/double_entry.rb'
end

Good to hear you've resolved your issue @jeffnappi. Do you have recommendations that you'd like implemented in DoubleEntry?