views:

185

answers:

1

I am going through the rails 3 tutorial at railstutorial.org. I have just created an extremely simple scaffold Users.

The scaffold-generated destroy link does not work in Internet Explorer. It redirects to the show action instead of deleting the user.

This problem only happens in IE9 and IE8 (the only IE versions I've tested so far) The problem DOES NOT happen in Firefox. Can anyone tell me why this is happening?

The view:

<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>

Generated HTML:

<a href="/users/1" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>

The controller:

def destroy
    @user = User.find(params[:id])
    @user.destroy

    respond_to do |format|
      format.html { redirect_to(users_url) }
      format.xml  { head :ok }
    end
end
+1  A: 

Make sure you have <%= javascript_include_tag :defaults %>

JS is now unobtrusive in rails 3, so the include is required to make it work.

theschmitzer
I do have this line in my default application layout, the problem still exists
louis11