James Collier wrote:
I have a side panel in my app that needs to have a link to the most
or 5 items in a table. How do I create this link?
For example, I have a controller named widgets, and I want to create a
to :controller => “widgets”, :action => “show”, and then the most recent
I want the text link to be the name of the widget.
Any ideas? Obviously, I’m another newbie…
I have a side panel that shows the most recently viewed items (across
multiple controllers). For example, a user may have viewed a lead, an
order, etc… I want to show the most recent 10 items viewed. Here is
a sample of the shared view file used for the panel:
<% for viewitem in @view_items%>
<tr valign="top" class="ListRow1">
<td width="25px" height="25px" align="right"><img alt="<%=
viewitem.controller.pluralize %>" src="/images/<%=
<%= link_to viewitem.value , :controller =>
viewitem.controller, :action => viewitem.action, :id => viewitem.item_id
<% end %>
My “view_items” are whatever your table is where the records are stored.
I store the name of the controller and the action in this table, but you
should be able to adjust accordingly. If this isn’t what you need then
please let me know and I’ll try to give a more specific example.