我想读取我的表的所有记录。这是我的代码关于路由的问题
控制器:
def list
@vorlesung=Vorlesung.find(:all)
end
查看:
<html>
<body>
<table>
<tr>
<th>
Name
</th>
</tr>
<% @vorlesung.each do |v| %>
<tr>
<td><%= v.Name %> </td>
</tr>
<% end %>
</table>
</body>
</html>
和击溃文件:
root :to => 'vorlesungs#Show'
match 'vorlesungs/new' =>'vorlesungs#new'
match 'vorlesungs' =>'vorlesungs#list'
resources :vorlesungs
我了解的CRUD我schould只写资源:vorlesungs。但我的代码不起作用没有匹配'vorlesungs'=>'vorlesungs#列表'你会有人告诉我这个理由吗?
谢谢,当我在控制器中更改我的函数的名称来索引和删除匹配'vorlesungs'=>'vorlesungs#list'时,这不起作用,并且出现错误:NoMethodError,我很抱歉,我是初学者:( –