I have the following ActiveAdmin form:
form do |f|
f.inputs "Timesheet Details" do
f.input :jobs_assigned_worker, :label => "Worker", as: :select, collection: Worker.all
f.input :worked_time_hours, :label => "Worked Time (Hours)"
f.input :worked_time_mins, :label => "Worked Time (Minutes)"
f.input :driving_time_hours, :label => "Driving Time (Hours)"
f.input :driving_time_mins, :label => "Driving Time (Minutes)"
f.input :spent_dollars, :label => "Extra Money Spent"
end
f.actions
end
When I use this form in the edit view, the select drop-down automatically defaults to the present value. However in production the drop-down is for some reason defaulting to the blank value at the top (why is that blank value there anyway?).
EDIT
The problem seems to be that ActiveAdmin doesn't understand the association and is unable to select associated object by default. I need to figure out how to code the f.input
for the association. The form is for a Timesheet. A Timesheet has_many
JobsAssignedWorkers and each JobsAssignedWorker has a Worker.