Select selected not working

Hi all,

I have this very simple code:


<% for country in @countries -%>
<% if country.id == @user.country %>

<%= country.name %> <% else %> <%= country.name %> <% end %> <% end -%>

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

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

ok, found the problem

it was a chaching problem of firefox :confused:
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs