title: form_for renders get rather than post, using rails
body: <p>I have a long form that auto-fills with information from our database (based upon partial information supplied by a user).  When the user verifies the information and re-submits the form, the information should be saved as the users.  The form - qualifying_events - is a partial that's in the views / shared folder.  The data that autofills it is rendered by the qualifying_events_controller as part of the create method.  The partial is presented for verification in a views / users page that's rendered by the user controller. The initial, partial information input by a user - in a similar partial on the same page - is correctly saving.  Here's the top of the form:</p>
  
  <pre><code>&lt;form class="form-inline"&gt;
    &lt;%= form_for(@qualifying_event) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: f.object %&gt;
  &lt;div &gt;   
    &lt;div class="form-group col-sm-12 text-center" style="margin-bottom: 5px;"&gt;&lt;h5&gt;
      &lt;div&gt;
        &lt;li style="list-style-type: none; float: left; display: none; visibility: hidden;"&gt;
        &lt;%= current_user %&gt;
        &lt;/li&gt;
      &lt;/div&gt;
      &lt;div&gt;
        &lt;li style="list-style-type: none; float: left;"&gt;
        &lt;%= f.label :class_date %&gt;&lt;br/&gt;
        &lt;%= f.text_area :class_date, autofocus: true %&gt;
        &lt;/li&gt;
      &lt;/div&gt; 
  </code></pre>
  
  <p>Here is the error message:</p>
  
  <pre><code>No route matches [GET] "/qualifying_events" 
  </code></pre>
  
  <p>Here's what I've tried:<br/>
  1. Explicitly adding a route to the config / routes file although it already showed if I ran rake routes:</p>
  
  <pre><code>post 'qualifying_events_path'     =&gt;  'qualifying_events#create'
  </code></pre>
  
  <p><br/>
  2. Changing the form_for language to explicitly call 'post':</p>
  
  <pre><code>&lt;%= form_for(@qualifying_event, url: qualifying_events_path, method: =&gt; post) do |f| %&gt;
  </code></pre>
  
  <p>I still get the same error message.  Since I have other forms that are saving to the database with the same code, I have to assume something changes when a form is populated from a database and one wants to re-save the information.  I'm using the devise gem so I looked at the registration#edit code, hoping I could follow the format:</p>
  
  <pre><code>  &lt;%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %&gt;
  </code></pre>
  
  <p>Unfortunately, that approach didn't work either.  </p>
  
  <p>For 'completeness', here's the qualifying_events_controller code:</p>
  
  <pre><code>def create 
    @user = current_user
    @qualifying_event = current_user.qualifying_events.build(qualifying_event_params) 
  
    if @qualifying_event.validated.nil?
    # Match partial course information from current_user with records in table
  
    # Get partial record's information
    active_date = @qualifying_event.class_date
    active_course = @qualifying_event.course_id
    active_sponsor = @qualifying_event.sponsor_name
  
    # Match on class_date, course_id, and sponsor_name
    @qualifying_event = QualifyingEvent.new
    @qualifying_event.assign_attributes(QualifyingEvent.
        where("(class_date = :class_date AND course_id = :course_id) 
        OR (class_date = :class_date AND sponsor_name = :sponsor_name) 
        OR (course_id = :course_id AND sponsor_name = :sponsor_name)",
        {class_date: active_date, course_id: active_course, 
            sponsor_name: active_sponsor}).first.attributes)
  
    # render to confirmation form / form for completion
    flash[:success] = "Qualifying Event saved for verification!"
    respond_to do |format|
      format.html  {render 'users/user_dashboard' }
    end
  
  else
    # if the record is complete          
    @qualifying_event.save
    flash[:success] = "Qualifying Event created!"
    redirect_to user_dashboard_path
  end 
  </code></pre>
  
  <p>There may be an error in the 'else' statement.  I haven't yet added the code to verify that all the required information is present, etc.</p>
  
  <p>I can save to and retrieve information from the database, however a re-submit of edited information calls 'get' rather than 'post.'  What am I missing?  Thank you in advance.</p>