2009-08-01 50 views
0

我试图在我的user_controller的索引操作上显示所有@ user.notes,并提供了一个表单来添加一个新的注释,内联。非常简单的代码,我从一些教程中收集,但发生了什么事情是我的观点完全重复。它吐出2份相同的html。对于rails还是很新的,所以我很难调试它。使用haml,fyi。Rails复制视图

这里是我的简单的代码:

# views/users/index.html.haml 
%p 
    Hi, #{@user.username}. 


%h3#notes Notes 
= render :partial => 'notes', :locals => {:notes => @user.notes} 


%h3 Add Note 
= remote_form_for([@user, @note]) do |f| 
    = f.error_messages 
    %ol.formList 

    %li 
     = f.label :body, "Note" 
     = f.text_field :body 
    %li 
     = f.submit 'Add Note' 

不知道如果这是造成它的代码。如果我删除remote_form_for块,它不会重复。让我知道你是否需要查看控制器代码或任何东西。

谢谢。

+0

看到控制器的代码可以帮助帮助您。谢谢 – marcgg 2009-08-01 20:23:53

回答

4

应该

- remote_form_for 

= remote_form_for 
+0

aaghh。谢谢= D – devth 2009-08-01 23:22:40