Marnen Laibow-Koser wrote:
> You're trying to pass a symbol instead of a variable into your query
> string, so of course it won't work. What you want is
> ["id = ?", continent_id.to_i] (without the colon).
>
> But you should never need to do it this way. For a simple equality
> check, use the hash syntax:
> {:id => continent_id.to_i}
> or consider find or find_by_id .
Ok I do understand now the Problem with the Symbols.
But with @product.continent = Continent.find({:id => continent_id.to_i})
I get
undefined local variable or method `continent_id'
waht I do understand because I'm in def update and the parameters witch
are passed are:
Parameters: {"commit"=>"Upd.... ,
"product"=>{"image_url"=>"/images/Burger.png",
"expirience_points"=>"10", "price"=>"1.99", "title"=>"WHOPPER®",
"description"=>"....", "continent_id"=>"7"}, "id"=>"1",
"controller"=>"products"}
But how do I get now from :product the "continent_id"=>"7"
--
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.