我遵循本指南http://www.2dconcept.com/jquery-grid-rails-plugin,设置示例jQuery数据网格。jqGrid错误与Ruby on Rails
一切似乎都很好,但是当我去http://127.0.0.1:3000/users,我得到这个:
NoMethodError in Users#index
Showing users/index.html.erb where line #12 raised:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
Extracted source (around line #12):
9: <th>Role</th>
10: </tr>
11:
12: <% for user in @users %>
13: <tr>
14: <td><%=h user.pseudo %></td>
15: <td><%=h user.firstname %></td>
任何想法,我做错了什么?
我认为这是正确的语法通过在@users每个用户去了? – NoahD 2009-09-16 23:37:26
我认为你的@users是零 - 在演示中他设置'users'而不是'@ users' – 2009-09-16 23:44:17
如果我从@users - >用户切换,我会为# –
NoahD
2009-09-17 00:06:48