I have a person has many questions model, I have accepts_nested_Attributes set up properly. the question from the db show up, but the index is not incrementing:
<%= f.fields_for :person_questions do |pregunta| %>
Questions: <br/>
<% Question.all.each do |question| %>
<%= render 'questions/question_type', :pregunta => pregunta, :question => question, :f => f %>
<% end %>
<% end %>
<div class="control-group">
<%= f.label :date_of_problema, :class => 'control-label' %>
<div class="controls">
<%= f.datepicker :date_of_problema, :class => 'date_select' %>
</div>
</div>
partial:
<div class="control-group">
<%= pregunta.label
question.name, (question.label_text unless question.label_text.nil?), :class => 'control-label' %>
<div class="controls">
<%= pregunta.send(question.data_type, :option_selected ) %>
<%= pregunta.hidden_field :question_id, :value =>
question.id , :class => "#{question.data_type}" %>
</div>
</div>
Is there a way to get the attribute names to be correct?
The questions come from the db.
chrome inspector:
<input id="person_person_questions_attributes_0_option_selected" name="person[person_questions_attributes][0][option_selected]" type="checkbox" value="1">
<input id="person_person_questions_attributes_0_option_selected" name="person[person_questions_attributes][0][option_selected]" size="30" type="text">