Question

I'm trying to display all @user.notes on my index action of the user_controller, and provide a form below to add a new note, inline. Pretty simple code that I've gleaned from a few tutorials, but what's happening is my view is completely duplicated. It spits out 2 copies of the same html. Still pretty new to rails so I'm having a hard time debugging this. Using haml, fyi.

Here's my simple code:

# 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'

Not sure if that's the code that's causing it. If I remove the remote_form_for chunk it doesn't duplicate anymore. Let me know if you need to see the controller code or anything.

Thanks.

Was it helpful?

Solution

It should be

- remote_form_for

not

= remote_form_for
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top