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">
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/lYzGc04VpAwJ.
For more options, visit https://groups.google.com/groups/opt_out.