Hello Jason,
Thanks for your response. Unfortunately that won't work since the local
variable ll being passed to the partial determines which model are we
working with so in my example that will have to be
edit_crust_type_path(a_rec). It is the dynamic substitution of the
model name that I am getting stuck on. Unfortunately I do not know the
meta_programming magic required to make it work :)
Anyway I have managed to do it the old-fashioned way by explicitly
spelling out the controllers and actions are shown below:
<% for a_rec in crud_table %>
<tr class="<%= cycle("odd","even") %>">
<td class="first"><%= a_rec.id %></td>
<td><%= a_rec.name %></td>
<td><%= a_rec.created_at %></td>
<td><%= a_rec.updated_at %></td>
<td><%= link_to 'Show', :controller => ll, :action => 'show', :id
=> a_rec.id %> |
<%= link_to 'Edit', :controller => ll, :action => 'edit', :id
=> a_rec.id %> |
<%= link_to 'Destroy', {:controller => ll, :action =>
'destroy', :id => a_rec.id} , :confirm => 'Are you sure?' %></td>
</tr>
<% end %>
This works fine, but I would still like to know how to do it using
meta-programming.
Bharat
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---