title: Update form in rails - No route matches [PUT]
body: <p>I have a form to create adverts. </p>
  
  <p>Controllers:</p>
  
  <pre><code>  def edit
      @engines = Engine.all
      @car = Car.find(params[:id])
    end
  
    def update
      @car = Car.find(params[:id])
  
      if @car.save
        redirect_to root_path
      end
    end
  </code></pre>
  
  <p>My routes:</p>
  
  <pre><code>resources :adverts
  </code></pre>
  
  <p>Create.html.erb</p>
  
  <pre><code>&lt;%= form_for @car, :url =&gt; adverts_path do |f| %&gt;
  
    &lt;div&gt;&lt;%= f.label :name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :name %&gt;&lt;/div&gt;
  
    &lt;%= hidden_field_tag :model_id, params[:model_id] %&gt;
  
    &lt;%= select_tag :engine_id, options_from_collection_for_select(@engines, "id", "name",:selected=&gt;@car.engine_id) %&gt;
  
    &lt;div&gt;&lt;%= f.submit "Create car!" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I can create advert, but I can't to update it. </p>
  
  <p>edit.html.erb</p>
  
  <pre><code>&lt;%= form_for @car, :url =&gt; adverts_path do |f| %&gt;
  
    &lt;div&gt;&lt;%= f.label :name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :name %&gt;&lt;/div&gt;
  
    &lt;%= hidden_field_tag :model_id, params[:model_id] %&gt;
  
    &lt;%= select_tag :engine_id, options_from_collection_for_select(@engines, "id", "name",:selected=&gt;@car.engine_id) %&gt;
  
    &lt;div&gt;&lt;%= f.submit "Update car!" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>when I submited my form, I have an error - <strong>No route matches [PUT] "/adverts"</strong></p>
  
  <p>$ rake routes: </p>
  
  <pre><code>                       adverts GET    /adverts(.:format)                     adverts#index
                                 POST   /adverts(.:format)                     adverts#create
                      new_advert GET    /adverts/new(.:format)                 adverts#new
                     edit_advert GET    /adverts/:id/edit(.:format)            adverts#edit
                          advert GET    /adverts/:id(.:format)                 adverts#show
                                 PUT    /adverts/:id(.:format)                 adverts#update
                                 DELETE /adverts/:id(.:format)                 adverts#destroy
  </code></pre>
  
  <p>I need help.</p>