Michael Yard wrote:
> Peter Degen-Portnoy wrote:
>> Peter Degen-Portnoy wrote:
>>> I found the solution (well, at least "a" solution).
>>
>> Yes, but not to the original question. I have the select box working
>> correctly (displaying text and setting a number), but the display field
>> (when the in_place_select is not active) is showing the value and not
>> the display text.
>>
>> - pdp
>
> Hi pdp,
>
> did you manage to solve this? I have the same problem. Bugs the sh.. out
> of me too.
> Hope you or anyone else have a solution.
> Thanks
>
> Mike
Hi Mike,
I picked up this code again after it sat unattended for a while.
I found that using the :display_text option solved the problem of
showing an intelligent value in the selection list while retaining the
ability to record the more efficient numerical representation to the
database.
Here's how it looks now:
in_place_select :contestSeries, :status,
:choices => {"Disabled" => "0", "Active => "1"}.collect {|k,v| [k,v]},
:display_text =>
convert_contest_series_status_codes(@contestSeries.status)
"convert_contest_series_status_codes" is a helper method used in a
variety of locations to convert "0" to "Disabled" and "1" to "Active".
Basically having something get the display string and pass it to
:display_text shows the correct value in the selection list.
Unfortunately, the display_text does not update after the value is
changed. One has to refresh the page after updating the value, so there
is still some more work to do.
--
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 [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
-~----------~----~----~----~------~----~------~--~---