Skip to content

Commit

Permalink
Change if statement for phone numbers to prevent NilClass errors
Browse files Browse the repository at this point in the history
  • Loading branch information
callumknights committed Jun 4, 2024
1 parent bc17916 commit 482ddfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/admin/worldwide_offices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def update

if (contact_numbers_attributes = update_params.dig(:contact_attributes, :contact_numbers_attributes))
contact_numbers_attributes.each do |_id, contact_number_attribute|
contact_number_attribute[:_destroy] = true if contact_number_attribute[:label].empty? && contact_number_attribute[:number].empty?
contact_number_attribute[:_destroy] = true unless contact_number_attribute[:label].present? && contact_number_attribute[:number].present?
end
end

Expand Down

0 comments on commit 482ddfc

Please sign in to comment.