Ruby on Rails Select then show!
Hey, I am new to Ruby on Rails and have been looking all over for some help on this question! First off I am PHP developer so my view on this may be off…
I am making a call to the database to find some records, I have it working fine but I am showing all the columns in the table that I am look at. So my database looks like this (|id|account_id|list_title|stat|), now when I go to show the results on a page I show the columns (|list_title|stat|) I only want to show (|list_title|). So here is what I have in my controller:
@post_pages, @lists = paginate :lists, :per_page => 10,
:conditions => "account_id='#{session[:user_id]}%' AND stat=1",
:order => 'id DESC'
And here is what I have in my view:
<% for list in @lists %>
<tr>
<% for column in List.content_columns %>
<td><%=h list.send(column.name) %></td>
<% end %>
</tr>
<%end%>
I just need to show the list_title and not all the columns, so I am asking how to loop through all the list_title’s for that user, and just show the list_title.
