It seems obvious, but it is good not to forget to check its helper code (and don't forget to check application_helper.rb, too).
module MyTripHelper def vehicle_type_form_column(record, input_name) select_tag input_name, options_for_select(MyTrip::VALID_VEHICLE_TYPES, record.vehicle_type) # record.vehicle_type was mistakenly set to something else! end end
Wednesday, September 30, 2009
Check the Helper When the Attribute in the ActiveScaffold Edit Pane Appears Default to Wrong Value
We were using ActiveScaffold to provide a UI for the CRUD operations and had an issue where the wrong value was being populated in a select box in the edit view. At first, I thought that the issue was that it was getting the value from the :default (specified in schema/migration and pulled from DB because table had set that column to default to the same value), but that turned out to be a coincidence. The issue that Paul D. found was that the helper that was populating the valid values of the select box had a bug in it such that it was setting the wrong value. For example: