title: Change GET to POST Ruby on Rails
body: <p>I have an Opportunity model. When I click my "Create Opportunity" button in my new form view, my terminal says that I made a "GET" request. Furthermore, after I click it, it does not make any run any of my validation scripts nor does it create a new record. I used "rake routes" and saw that my new_opportunite route is a GET request:</p>
  
  <p>new_opportunity GET    /opportunities/new(.:format)    opportunities#new </p>
  
  <p>Does anyone know how I can change that route to make it a POST?</p>
  
  <p>Thanks!!                              </p>
  
  <p>rake routes:</p>
  
  <pre><code>            Prefix Verb   URI Pattern                                                  Controller#Action
            opportunities GET    /opportunities(.:format)                                     opportunities#index
                          POST   /opportunities(.:format)                                     opportunities#create
          new_opportunity GET    /opportunities/new(.:format)                                 opportunities#new
         edit_opportunity GET    /opportunities/:id/edit(.:format)                            opportunities#edit
              opportunity GET    /opportunities/:id(.:format)                                 opportunities#show
                          PATCH  /opportunities/:id(.:format)                                 opportunities#update
                          PUT    /opportunities/:id(.:format)                                 opportunities#update
                          DELETE /opportunities/:id(.:format)                                 opportunities#destroy
  </code></pre>
  
  <p>routes file:</p>
  
  <pre><code>Rails.application.routes.draw do
  
    resources :test_users
  
    get 'profile/my_profile'
  
    get "log_out" =&gt; "sessions#destroy", :as =&gt; "log_out"
  
    get "log_in" =&gt; "sessions#new", :as =&gt; "log_in"
  
    get "sign_up" =&gt; "users#new", :as =&gt; "sign_up"
    root :to =&gt; "sessions#new"
  
    get 'view_submitted/submitted'
  
    get 'view_action_list/seven'
  
    get 'show_number/thirty'
  
    get 'show_number/sixty'
  
    get 'show_number/year'
  
    get 'view_retired/retired'
  
    resources :users
    resource :sessions
  
    get 'report/report_page'
  
    resources :opportunities do
      resources :activities
      resources :updates
      resources :contacts
      resources :links
  
    end
  </code></pre>
  
  <p>my form:</p>
  
  <pre><code>    &lt;%= form_for(@opportunity) do |f| %&gt;
        &lt;% if @opportunity.errors.any? %&gt;
          &lt;div id="error_explanation"&gt;
            &lt;h2&gt;&lt;%= pluralize(@opportunity.errors.count, "error") %&gt; prohibited this opportunity from being saved:&lt;/h2&gt;
            &lt;ul&gt;
            &lt;% @opportunity.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;table id="new_opp_form" style="width: 450px; background-color: white; border-style: none; border:1px orange;"&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Department&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :department, [[],['DHS', 'DHS'], ['DOS', 'DOS'], ['FDIC', 'FDIC'], ['HUD', 'HUD'], ['SEC', 'SEC'], ['VA', 'VA']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Agency&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :agency %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Program Name&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :program_name %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Stage&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :stage, [[],['Assessment', 'Assessment'], ['Pre-Proposal', 'Pre-Proposal'], ['Proposal', 'Proposal'], ['Subitted', 'Submitted'],['Retired', 'Retired']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Capture Manager&lt;/td&gt;
              &lt;td&gt;&lt;%= f.collection_select(:capture_manager, User.all, :full_name,:full_name,{:prompt =&gt; true}) %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Program Description&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_area :program_description %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;New or Re-recompete&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :new_or_recompete, [[],['New', 'New'], ['Re-Compete', 'Re-Compete']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Incumbent&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :incumbent %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Current Contract Vehicle&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :curent_contract_vehicle %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;New Contract Vehicle&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :new_contract_vehicle %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Small Business Set Aside?&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :sb_set_aside, [[],['Yes', 'Yes'], ['No', 'No']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Prime or Sub&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :prime_or_sub, [[],['Prime', 'Prime'], ['Sub', 'Sub']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;NAICS&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :naics %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;RFI Date&lt;/td&gt;
              &lt;td&gt;&lt;%= f.date_select :rfi_date, {:include_blank =&gt; true, :default =&gt; nil} %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;RFI Submitted?&lt;/td&gt;
              &lt;td&gt;&lt;%= f.select :rfi_submitted, [[],['Yes', 'Yes'], ['No', 'No']] %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Est. RFP Date&lt;/td&gt;
              &lt;td&gt;&lt;%= f.date_select :est_rfp_date, {:include_blank =&gt; true, :default =&gt; nil} %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Est. Full Value&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :est_full_value%&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Est. Workshare (%)&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :est_workshare %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;P(win) %&lt;/td&gt;
              &lt;td&gt;&lt;%= f.text_field :p_win %&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr style="background-color: white"&gt;
              &lt;td&gt;Govwin ID&lt;/td&gt;
              &lt;td&gt; &lt;%= f.text_field :govwin_id %&gt;&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
        &lt;div class="actions"&gt;
          &lt;%= f.submit %&gt; 
        &lt;/div&gt;
      &lt;% end %&gt;
  </code></pre>