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

Remove empty array associations created via UI from association list #16919

Merged
merged 1 commit into from
Feb 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/dialog_import_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_dialog_fields_for_validity(dialog_fields)

def check_dialog_associations_for_validity(dialog_fields)
associations = {}
dialog_fields.each { |df| associations.merge!(df["name"] => df["dialog_field_responders"]) unless df["dialog_field_responders"].nil? }
dialog_fields.each { |df| associations.merge!(df["name"] => df["dialog_field_responders"]) if df["dialog_field_responders"].present? }
unless associations.blank?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop is not complaining about the line you changed, but does about line 61 that you reverted back. 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but I still think this needs to be a stricter check, that of presence, rather than the one that's existing, because the UI associations have blank arrays that need to be dealt with here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What confused me is the PR is labeled as cleanup but I think you are really addressing a bug. I initially thought this was just a refactoring based on rubocop warnings. Re-reading the description it sounds like it is a bug.

circular_references = @dialog_field_association_validator.circular_references(associations)
raise DialogFieldAssociationCircularReferenceError, circular_references if circular_references
Expand Down