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?