codemancers / invoicing

Ruby invoicing framework gem
http://invoicing.c9s.dev/
MIT License
265 stars 40 forks source link

Rails 5.2 and nested_form_fields gem #84

Open mariia-kulakova opened 4 years ago

mariia-kulakova commented 4 years ago

After upgrading from 4.2 to rails 5.2 gem doesn't allow to use nested_form_fields any more. Error message is 'Cannot determine currency for line item without a ledger item'. nested_form_fields gem uses empty object by default (in this case ledger_item is nil)

iffyuva commented 4 years ago

@mariia-kulakova thanks for the report. Is there any code snippet which I can use to reproduce this issue?

mariia-kulakova commented 4 years ago

@iffyuva Thanks for quick responding! I created mini project, which you can setup and run to see issue - https://github.com/mariia-kulakova/invoicing-nested_form_fields_app After running project please go to http://localhost:3000/invoices/new - here is issue

iffyuva commented 4 years ago

I will take a look and get back to you @mariia-kulakova

mariia-kulakova commented 4 years ago

@iffyuva Thank you

leerodgers commented 4 years ago

Hi @iffyuva - we were curious when you would be able to provide an update on this. This is a blocker for us and we can try to investigate a solution if necessary.

iffyuva commented 4 years ago

Hi @leerodgers , I'm thinking of picking this coming weekend. I'd suggest that you also debug this issue at your end.

mariia-kulakova commented 4 years ago

@iffyuva When I replace this line: https://github.com/code-mancers/invoicing/blob/master/lib/invoicing/line_item.rb#L199 with return if ledger_item.nil? - it works fine. Can it be as solution for this issue or it can break anything?

leerodgers commented 4 years ago

@iffyuva - Is the fix in that fork good? Can you merge it into the repo? Works for us 👍