Hi I want to assign continents to my products with a drop down box.
I managed to get everyting runing but now i have a probably quite easy
to solve problem.
I don't get the update running.

What want to do is basically:
SELECT * FROM "continents" WHERE ("continents"."id" = "continent_id")
LIMIT 1

But I don't find the right syntax.

At the moamnt it looks like this:
SELECT * FROM "continents" WHERE (id = '--- :continend_id') LIMIT 1

The parameters of my update are looking like this:
Parameters: {"commit"=>"Update", "action"=>"update", "_method"=>"put",
"authenticity_token"=>"***", "product"=>{"image_url"=>"w.jpg",
"expirience_points"=>"0", "price"=>"1", "title"=>"w",
"description"=>"w", "continent_id"=>"7"}, "id"=>"11",
"controller"=>"products"}

This is the code of may update methode:
def update
   @product = Product.find(params[:id])
@product.continent = Continent.find(:first, :conditions => [ "id =
?",:continend_id ])
    if @product.update_attributes(params[:product])
      flash[:notice] = 'Product was successfully updated.'
      redirect_to(@product)
    else
      render :action => "edit"
    end
  end
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to