Skip to content

Commit 36f4fe8

Browse files
authored
Merge pull request #4855 from rubyforgood/fix-default-location
Fix default location PR
2 parents 49c9308 + a201cb7 commit 36f4fe8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/views/donations/_donation_form.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<div class="col-xs-8 col-md-6 col-lg-3">
4040
<%= f.association :product_drive_participant,
4141
collection: @product_drive_participants,
42-
selected: default_location(@donation),
42+
selected: donation_form.product_drive_participant_id,
4343
include_blank: true,
4444
label_method: lambda { |x| "#{x.try(:business_name) }" },
4545
label: "Product Drive Participant",
@@ -67,7 +67,7 @@
6767
collection: @storage_locations,
6868
label: "Storage Location",
6969
error: "Where is it being stored?",
70-
selected: donation_form.storage_location&.id || current_organization.intake_location,
70+
selected: donation_form.storage_location&.id || default_location(@donation),
7171
include_blank: true,
7272
wrapper: :input_group %>
7373
</div>

spec/requests/donations_requests_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
expect(response.body).to include("<li class=\"breadcrumb-item\">\n <a href=\"#\">Editing #{original_source}")
269269
expect(response.body).to include("<option selected=\"selected\" value=\"#{edited_source}\">#{edited_source}</option>")
270270
expect(response.body).to include("<option selected=\"selected\" value=\"#{edited_source_drive.id}\">#{edited_source_drive_name}</option>")
271-
expect(response.body).to include("<option value=\"#{edited_source_drive_participant.id}\">#{edited_source_drive_participant_business_name}</option>")
271+
expect(response.body).to include("<option selected=\"selected\" value=\"#{edited_source_drive_participant.id}\">#{edited_source_drive_participant_business_name}</option>")
272272
expect(response.body).to include("<option selected=\"selected\" value=\"#{edited_storage_location.id}\">#{edited_storage_location_name}</option>")
273273
expect(response.body).to include(edited_comment)
274274
expect(response.body).to include("value=\"#{edited_money}\" type=\"text\" name=\"donation[money_raised_in_dollars]")

0 commit comments

Comments
 (0)