Forum: Ruby on Rails helpefying a list partial

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Gerard P. (Guest)
on 2006-01-21 12:39
(Received via mailing list)
Hi all,

I've got this code which is alway the same. In a list it displays a
show, edit
and destroy icon behind each record.
<% 	for todo in @todos %>
  <tr valign="top" class="ListLine<%= cycle("0","1") %>">
    <td><%=h todo.prio %></td>
    <td><%=h todo.title %></td>
    <td><%= todo.description.gsub("\n", '<br />') %></td>

	## It's the part below ##
	<td><%= link_to(image_tag("/images/show.png"), :action => 'show_todo',
:id =>
todo) %></td>
	<td><%= link_to(image_tag("/images/edit.png"), :action => 'edit_todo',
:id =>
todo) %></td>
	<td><%= link_to(image_tag("/images/delete.png"), { :action =>
'destroy_todo', :id => todo }, :confirm => 'Are you sure?') %></td>
<% end %>

The only thing that changes is the word 'todo'. Ik would like something

<% crud(current list item) %>

Is that doable? And is a helper the right place to put this or should id
go in
a partial?


Grtz Gerard.

"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
This topic is locked and can not be replied to.