rubyforgood / coral

An upcoming project for Ruby for Good
MIT License
13 stars 11 forks source link

Fix new nursey table form (bug) #67

Closed LizPrescott closed 4 years ago

LizPrescott commented 4 years ago

Expected behavior: New nursery table form should create a new nursery table associated with the selected zone. Form should populate a zone id based on the dropdown.

Actual behavior: Attempts to create a new nursery table result in an error "Zone must exist" even if I have a zone selected: Screenshot_2019-08-14 Coral Gardeners

In the console, I noticed that the form is using the zone name, rather than the id, to look for the zone.

Processing by NurseryTablesController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"XsLtVJiFRo1+QE3Z4GySTPUNReOrccOERlRoK5dSLiIDSZcHxCgFIyz8MTL/zlzQfW1sTwJODjodtUlSHP3NOQ==", "nursery_table"=>{"capacity"=>"200", "zone_id"=>"fa", "name"=>"fa"}, "commit"=>"Create Nursery table"}

Step to reproduce: Create a new zone at /zones/new Navigate to nursery_tables/new Select your new zone from the drop down. Fill in all fields with test data and hit "Create Nursery Table" Observe errors in the browser and the rails console (you may need to scroll up)

conj40 commented 4 years ago

Hi there @LizPrescott , i have found a fix for this. Will do a PR :)