[Rails] Re: Can't get select helper to populate dropdown w/default v

Peter Jagielski pjagielski at gmail.com
Sun Jan 1 18:33:17 GMT 2006


Guys,

Ok, problem solved.  I changed my hash from:

YESNO = { "No" => "0",
          "Yes" => "1" }

to:

YESNO = { "No" => 0,
          "Yes" => 1 }

The field's type in my table is SMALLINT, so now the hash matches. 
So...the following code works:

<%= select 'user', 'administrator', Bug::YESNO, :include_blank => TRUE 
%>

Thanks Kevin & Nick!  Happy New Year!

Hope this helps the other folks getting this kind of thing to work!

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list