PUT-ing a form to update a row, but I can't find the id. Where is it?
- by montooner
How should I be passing in the ID?
Error:
  Couldn't find Product without an ID
Form:
<% form_for :product, @product, :url => { :action => :update } do |f| %>
  <%= f.error_messages %>
  <p>
    <%= f.label :names %><br />
    <%= f.text_field :names %>
  </p>
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>
Controller (for /products/edit/1 view):
def edit
  @product = Product.find(params[:id])
end
Controller (to change the db):
def update
    @product = Product.find(params[:id])
    respond_to do |format|
      if @product.update_attributes(params[:product])
        format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @product.errors, :status => :unprocessable_entity }
      end
    end
  end