title: Making a survey app, how should I delete questions (and add some layout)?
body: <p>I'm making a survey app using a Survey model, which has_many Questions which itself has_many answers. The form partial looks like this:  </p>
  
  <pre><code>&lt;%= form_for(@survey) do |f| %&gt;
    &lt;% if @survey.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(@survey.errors.count, "error") %&gt; prohibited this survey from being saved:&lt;/h2&gt;
  
        &lt;ul&gt;
        &lt;% @survey.errors.full_messages.each do |message| %&gt;
          &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
  
    &lt;div class="field"&gt;
      &lt;%= f.label :name %&gt;&lt;br&gt;
      &lt;%= f.text_field :name %&gt;
    &lt;/div&gt;
  
    &lt;%= f.fields_for :questions do |question_attribute| %&gt;
    &lt;p&gt;
      &lt;%= question_attribute.label :content, "Question" %&gt;&lt;br /&gt;
      &lt;%= question_attribute.text_area :content, :rows =&gt; 3 %&gt;
    &lt;/p&gt;
  
     &lt;%= question_attribute.fields_for :answers do |answer_attribute| %&gt;
      &lt;p&gt;
        &lt;%= answer_attribute.label :content, "Answer" %&gt;
        &lt;%= answer_attribute.text_field :content %&gt;
  
      &lt;/p&gt;
     &lt;% end %&gt; 
   &lt;% end %&gt; 
  
  
  
    &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>and is called by the edit and new actions. <strong>quick side note: how is it that rails fills in previous question/answer values in the form when called by the edit action?</strong></p>
  
  <p>I want to make it so that when I visit each survey's edit page, beside each question will be a "delete" link, and when I press that delete link the question is deleted from the survey and I'm directed back to the edit page. How should I accomplish this? I took a look at some railscasts but everything they did had been deprecated already.  </p>
  
  <p>In addition, right now when I <code>show</code> a survey, the questions aren't numbered ie Question 2, Question 2, etc. and the Answers for each question aren't numbered a), b), c), d), e). How do I make rails automatically number these when I create a survey? My show form looks like this:  </p>
  
  <pre><code>&lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Name:&lt;/strong&gt;
    &lt;%= @survey.name %&gt;
  &lt;/p&gt;
  
  &lt;ol&gt;
    &lt;% @survey.questions.each do |question| %&gt;
    &lt;li&gt;&lt;%= question.content  %&gt;
    &lt;ul&gt;
      &lt;% for answer in question.answers %&gt;
  
      &lt;li&gt;&lt;%= answer.content %&gt;&lt;/li&gt;
  
      &lt;% end %&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
      &lt;% end %&gt;
  &lt;/ol&gt;
  
  
  &lt;%= link_to 'Edit', edit_survey_path(@survey) %&gt; |
  &lt;%= link_to 'Back', surveys_path %&gt;
  </code></pre>