hi..
I'm having a problem with an editing view  to show a dropdown list
with selected value.

my tables are as followed
product table : id | Name | Price | Country_id
country table : id | CountryName

on the product new.htm.erb, I've got the list like this
<%= collection_select ("product", "Country_id",
@country, :id, :CountryName) %>
and it generates <select> html tags and saves good too.

now, I'd like to edit the product on the edit.html.erb with the same
dropdown list with
collected product.Country_id.

<option value = "{product.Country_id}" selected > CountryName</option>

anyone knows how to to this?  I've tried the rails.api way of doing
it.. such as

select(:product, :Country_id, country.find(:all).collect {|c|
[ c.CountryName, c.id ] }, {:include_blank => 'None'})
and it didn't work..

--~--~---------~--~----~------------~-------~--~----~
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