Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeds many tracking fails if original value is nil #245

Open
vanboom opened this issue Jul 22, 2020 · 0 comments
Open

Embeds many tracking fails if original value is nil #245

vanboom opened this issue Jul 22, 2020 · 0 comments
Labels

Comments

@vanboom
Copy link

vanboom commented Jul 22, 2020

I have a case where I am loading model attributes from YML and the history tracking of an embedded relation was failing on line 93 of update.rb. The value[0] value is nil.

  original_value = (value[0]).reject { |rel| rel[paranoia_field].present? }
                                   .map { |v_attrs| format_embeds_many_relation(relation, v_attrs) }
          modified_value = value[1].reject { |rel| rel[paranoia_field].present? }
                                   .map { |v_attrs| format_embeds_many_relation(relation, v_attrs) }

proposed fix...

  original_value = (value[0] || []).reject { |rel| rel[paranoia_field].present? }
                                   .map { |v_attrs| format_embeds_many_relation(relation, v_attrs) }
          modified_value = value[1].reject { |rel| rel[paranoia_field].present? }
                                   .map { |v_attrs| format_embeds_many_relation(relation, v_attrs) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants