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:
Zeitung: <%=h @auftrag.zeitung %>
Zeitung sonst: <%=h @auftrag.zeitung_sonst %>
Gemeinschaft: <%=h @auftrag.gemeinschaft %>
Ersch datum: <%=h @auftrag.ersch_datum %>
Art: <%=h @auftrag.art %>
Spalten: <%=h @auftrag.spalten %>
Format: <%=h @auftrag.format %>
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 > “” %>
<%= KEYNAME %>:
<%= 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?
