Hi all, I have this very simple code: <select id="user_country" name="user[country]" style="width:255px;" class="input" size="1"> <% for country in @countries -%> <% if country.id == @user.country %> <option value="<%= country.id %>" selected="selected"><%= country.name %></option> <% else %> <option value="<%= country.id %>"><%= country.name %></option> <% end %> <% end -%> </select> this produces a list of countrynames and when the user country is the same it should select it. It does select it - but the select drop down is showing the first entry instead of the selected one??? any ideas? I dont know whats up with that thanks for any tip andreas -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ehhhh... this is not true or? in rails is a complete country list??? I found this here: country_select(object, method, priority_countries = nil, options = {}, html_options = {}) I build my own database with countries today:( it seams there is a command for anything in rails aaaahhhh... my whole day of work to build the country database is not needed andreas -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ok, found the problem it was a chaching problem of firefox :/ and I replaced my ugly styled country selector with the fresh and easy to use rails verson <%=select("user", "country", Country.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }, :class => ''input'', :style => ''width:255px'') %> live can be so easy andreas -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---