invoicing icon indicating copy to clipboard operation
invoicing copied to clipboard

Rails 5.2 and nested_form_fields gem

Open mariia-kulakova opened this issue 4 years ago • 8 comments

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)

mariia-kulakova avatar Oct 09 '20 12:10 mariia-kulakova

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

iffyuva avatar Oct 09 '20 12:10 iffyuva

@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

mariia-kulakova avatar Oct 09 '20 13:10 mariia-kulakova

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

iffyuva avatar Oct 09 '20 15:10 iffyuva

@iffyuva Thank you

mariia-kulakova avatar Oct 09 '20 17:10 mariia-kulakova

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.

leerodgers avatar Oct 13 '20 13:10 leerodgers

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

iffyuva avatar Oct 13 '20 14:10 iffyuva

@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?

mariia-kulakova avatar Oct 15 '20 15:10 mariia-kulakova

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

leerodgers avatar Oct 23 '20 19:10 leerodgers