small medium large xlarge

24 May 2010, 07:44
Joe Straitiff (7 posts)

So, when I add the Empty cart button, there is a :confirm in the button_to, however, there is no confirmation dialog displayed when I click the button.

Here’s the generated html:

<form method="post" action="/carts/5"  class="button_to"><div><input name="_method" type="hidden" value="delete" /><input data-confirm="Are you sure?" type="submit" value="Empty cart" /><input name="authenticity_token" type="hidden" value="6b0sGW99we5lx5SqoBZaS0EXLxP+D0lt+/mmrO3Dcfk=" /></div></form>

Any ideas about why this would happen? Am I misunderstanding what the :confirm is supposed to do? I tried in multiple browsers just to be sure…


24 May 2010, 07:59
Joe Straitiff (7 posts)

oki, I answered my own question, it’s the javascript_include_tag missing from app/views/layouts/application.html.erb. It was removed on p. 106 when overwritten by the version there.

So add back:

<%= javascript_include_tag :defaults %>

In the head before csrf_meta_tag and you’re golden.

25 May 2010, 15:29
Sam Ruby (633 posts)

I’ve changed the book so that in the next beta it will be in there in the first place. Thanks!

You must be logged in to comment