hi all,
i have a sql obj
(in controller)
ex: @c = C.find_by_sql(“select * from a,b”)
and i want to print all content in this sql obj c in view .
is there a better way or easy way to print all column name(scheme) in @c
with a table in
and just to print all content in @c with a table in | ?
my orginal way :
a |
b |
c |
<% # may i just print all column name in @c with just a iterator ? %>
<% for c in @c %>
c.a |
c.b |
c.c |
<% # may i just print all content in @c with just a iterator ? %>
<%end%>
thanks
|
<% for column in {tablename}.content_columns %>
<%= column.human_name %> |
<% end %>
This is all.
nicolas55ar wrote:
<% for column in {tablename}.content_columns %>
<%= column.human_name %> |
<% end %>
This is all.
thanks, but it works only with “table”,
and i want to take with “query result”,
ex: @c = C.find_by_sql(“select * from a,b”)