vitaly / debitcredit

Double Entry Accounting for Rails
MIT License
18 stars 8 forks source link

ActiveRecord 5.0+ incompability #7

Open aleksey-bitwine opened 7 years ago

aleksey-bitwine commented 7 years ago

Since ActiveRecord 5.0 the "[]" method is not called via method_missing: https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/relation/delegation.rb#L39

So accounts[:outstanding, :liability, true] raises "ArgumentError: wrong number of arguments (given 3, expected 1..2)" exception.

I think that https://github.com/vitaly/debitcredit/blob/master/app/models/debitcredit/account.rb#L25 has to be renamed and "[]" can be an alias only (for backward compatibility)

aleksey-bitwine commented 7 years ago

I have created workaround: https://github.com/barges/debitcredit/commit/78285a237137305961f4a5faa915ef38bb18d021

It works