Forum: Ruby on Rails Data manipulation from a database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ken K. (Guest)
on 2006-06-04 23:05
Say, for example, I have this in my db:

id    name      date
1     Item_1    feb-19
2     Item_2    feb-20

and I want to manipulate it so that the view can output this:

feb-19:
   Item1
feb-20:
Ken K. (Guest)
on 2006-06-04 23:06
Sorry

feb-19:
   Item_1
feb-20:
   Item_2


How would I go about doing that?
Ioana K. (Guest)
on 2006-06-05 13:39
(Received via mailing list)
Maybe smth like that:
def list
   @examples = Example.find(:all)
end
<!--list.rhtml-->
<ul>
<%for ex in @examples%>
    <li><%= ex.date%>:
       <%ex.name%></li>
<%end%>
</ul>
Also I think it's better to change your column name from "date to
"created_at"/"updated_at" or add them both.
Ioana K. (Guest)
on 2006-06-05 13:43
(Received via mailing list)
I forgot to mention smth: the data u wrote I assumed to be part of
"examples" table from your db.
This topic is locked and can not be replied to.