So I'm using nested_form (v0.3.2 according to Gemfile.lock) with Rails 3.2.11. I have a Service model with a category field that initially can take on multiple values that can be input via a select dropdown.
The categories are something like: ["J Award", "Z Award", "Other" ]
When I go to save the form fields with a value of J Award (or Z Award) and rerender an editable form, the form redisplays with a value of "Other" for category. Yet if I step into the rails console and look at the category field of the saved service model, it shows "J Award".
What could be causing this? Since nested_form is no longer maintained, should I just give up and handle multiple models in a single form differently?
haml output of rerendered form
= semantic_nested_form_for @service, :url => "/update", :html => { :class => "service", :autocomplete => "off" } do |f|
%h1.page-title Service
.page-wrapper
= render :partial => "shared/error_messages", :locals => { :object => @service }
html output of rerendered form:
<li class="string input required stringish" id="service_category_input"><label class=" label" for="service_category">Category<abbr title="required">*</abbr></label><input id="service_category" maxlength="255" name="service[category]" type="text" value="J Award" />
</li>
= f.inputs do
%h3 Project Information
= f.input :billable, :as => :radio, :collection => { 'Billable' => true, 'Non-billable' => false }, :label => 'Category', :input_html => { :disabled => true }
= f.input :category
= f.input :assigned_consultant, :input_html => { :readonly => true }
= f.input :aims, :input_html => { :readonly => true }
Aucun commentaire:
Enregistrer un commentaire