[Rails] another select_list question - bad bad booleans
Kevin Olbrich
devlists-rubyonrails at devlists.com
Wed Mar 1 07:35:15 GMT 2006
I know this doesn't answer your question... it's late here, but why are
you using a drop down for a binary choice instead of something like a
check box or radio button?
_Kevin
On Tuesday, February 28, 2006, at 11:36 PM, Craig White wrote:
>I have a select list for a boolean column in postgresql
>
>in the 'model' ...
> YES_NO = [
> [ "Yes", "1" ],
> [ "No", "0" ]
> ].freeze
>
>in the 'view code' ...
>
><%= options = [['Accepted?', '']] + Placement::YES_NO
> select("placement", "accepted", options) %>
>
>When creating new records, I can select Yes or No and it writes the
>proper value to table.
>
>When I edit existing records, unlike other select list menus which
>automatically go to the existing value in the select list, the
>'Accepted' list always displays "Accepted?' (the prompt, never the
>value) in the pop-up selected list, no doubt because it cannot figure
>out the reverse translation of existing column 0's and 1's backwards to
>Yes : No logic.
>
>What is the trick to do that?
>
>Thanks
>
>Craig
>
>_______________________________________________
>Rails mailing list
>Rails at lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
--
Posted with http://DevLists.com. Sign up and save your time!
More information about the Rails
mailing list