Too Few Arguments

Posted by NoahClark on Stack Overflow See other posts from Stack Overflow or by NoahClark
Published on 2012-06-26T14:45:10Z Indexed on 2012/06/26 15:16 UTC
Read the original article Hit count: 232

I am trying to get some Javascript working in my Rails app.

I want to have my index page allow me to edit individual items on the index page, and then reload the index page upon edit.

My index.html.erb page looks like:

<div id="index">
<%= render 'index' %>
</div>

In my index.js.erb I have:

$('#index').html("<%=j render 'index' %>");

and in my holders_controller:

def edit
  holder = Holder.find(params[:id])
 end

def update
  @holder = Holder.find(params[:id])
  if @holder.update_attributes(params[:holder])
    format.html { redirect_to holders_path } #, flash[:success] = "holder updated")
    ## ^---Line 28 in error
    format.js
  else
    render 'edit'
  end
end

When I load the index page it is fine. As soon as click the edit button and it submits the form, I get the following:

enter image description here

But if I go back and refresh the index page, the edits are saved. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails-3