accessing the keyname and the value

Hello in PHP i can access the Keynames of an array by using this option:

        while(list($k,$v) = each($uebergabe)) {                         if($k <> "Abschicken" ){                                 $koepfe = $k;                                 $werte = $v;                         }//if                 }//while

I want do use this in rails do make my code more flexible. I have a database and in the showview it is displayed like this: <p>   <b>Zeitung:</b>   <%=h @auftrag.zeitung %> </p>

<p>   <b>Zeitung sonst:</b>   <%=h @auftrag.zeitung_sonst %> </p>

<p>   <b>Gemeinschaft:</b>   <%=h @auftrag.gemeinschaft %> </p>

<p>   <b>Ersch datum:</b>   <%=h @auftrag.ersch_datum %> </p>

<p>   <b>Art:</b>   <%=h @auftrag.art %> </p>

<p>   <b>Spalten:</b>   <%=h @auftrag.spalten %> </p>

<p>   <b>Format:</b>   <%=h @auftrag.format %> </p>

But if a field ist empty the name is also displayed. so my thougt ist something like this: <% @auftrag.each do |item|%> <% if @auftrag.format > "" %> <b><%= KEYNAME %>:</b> <%= h @auftrag.format %> <%end%> <%end%>

BUT how do i get the name of the current key belonging to the value? The Array @auftrag is defined in the Controller by using @auftrags = Auftrag.find(:all)

Any Idea?

<% @auftrag.attributes.each do |key, item| %> <% if @auftrag.format > "" %> <b><%= key %>:</b> <%= h @auftrag.format %> <%end%> <%end%>

would work

btw: using german for naming is a bad idea, since it breaks Rails pluralization.

next problem: when i compare the items with "" I get the follwing error, when i have a DATE-Field: "comparison of Time with String failed" Is there a more elegant way to ask if the Item-Field has values in it?