Rya*_*yan 0 routing routes ruby-on-rails-3
我有一个名为PointOfContact的模型,我用脚手架创建; 所以它应该有一些相似的正确性.
基本上,我想要我的路线的别名.而不是去'/ point_of_contacts',我想'/ pocs',我不希望'/ point_of_contacts'成为有效路线.
我试过这个:
resources :pocs, :controller => "point_of_contacts"
Run Code Online (Sandbox Code Playgroud)
这有助于创建'/ pocs'路线.但是,现在我不确定如何编写我的观点.特别:
<% @point_of_contacts.each do |point_of_contact| %>
<tr>
<td><%= point_of_contact.first %></td>
<td><%= point_of_contact.last %></td>
<td><%= point_of_contact.title %></td>
<td><%= point_of_contact.phone %></td>
<td><%= point_of_contact.email %></td>
<td><%= link_to 'Show', point_of_contact %></td>
</tr>
<% end %>
Run Code Online (Sandbox Code Playgroud)
该代码创建此异常:
No route matches {:action=>"show", :controller=>"point_of_contacts", :id=>#<PointOfContact id: 1, system_id: nil, first: "Tester", last: "Test", title: "", phone: "", email: "", created_at: "2011-03-10 20:03:21", updated_at: "2011-03-10 20:03:21">}
| 归档时间: |
|
| 查看次数: |
3018 次 |
| 最近记录: |