0
同样的问题已经被询问了很多次,但我无法找到适合我的解决方案。Rails中控制器在另一个控制器中的渲染视图
我有三种模式,帖子,用户和图片(回形针)。
我使用restful_authentication并进行设置,以便每个用户只能在帖子/索引中看到他/她的帖子。我也给了他上传个人资料图片的能力。
我的问题是我如何拍照/索引并在帖子/索引中显示。我想在帖子/索引页面顶部显示缩略图,然后是帖子。
我用的谐音,但我得到的错误
NoMethodError in Posts#index
Showing app/views/us/_picture.html.erb where line #1 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 #1):
1: <% for u in @us %>
2: <tr>
3: <td><%= image_tag u.picture.url(:thumb) %></td>
4: <td><%=h u.name %></td>
我看看它都试图做的,我怎么解决它,这样它只是显示上传的图片。
感谢您的帮助。
感谢您的答复。我得到“没有身份证找不到U”。难道是因为我没有属于用户的图片(不是在restful_authentication下?) – 2010-01-02 18:08:09