Delete :confirm => "Sure?"

Hey all, well I have a delete function in my rails application that
works successfully. When I click the button it deletes the record from
the page as well as the database, my problem is that I don’t want it to
instantaneously do this, I want it to give the user the option to cancel
before hand. How would I do this. My code for the button is as followed:

_form.html.erb/games

<%= f.submit %>
<%= button_to ‘Destroy’, root_url, :confirm => ‘Sure?’, :method =>
:delete %>

Application.html.erb

Wishlist <%= stylesheet_link_tag "/stylesheet/style", :media => "all"%> <%= javascript_include_tag :all %> <%= csrf_meta_tags %>

Anything I am missing?

Mine work fine here, what rails version did you use.

Im using 3.2 here, make sure that the page include:

or something similar.

Ahmy Y.

On Tue, Feb 14, 2012 at 5:49 AM, Ahmy Y. [email protected]
wrote:

Mine work fine here, what rails version did you use.

Im using 3.2 here, make sure that the page include:

<script

src=“/assets/jquery_ujs.js?body=1http://localhost:3000/assets/jquery_ujs.js?body=1

type=“text/javascript”>

Regarding the asset pipeline, I think it is better to write

<%= javascript_include_tag “application” %>

so that the application will also correctly use the MD5 fingerprinted
names
in production.

I would avoid writing the src url manually and always use the
javascript_include_tag.

HTH,

Peter


*** Available for a new project ***

Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com
http://coderwall.com/peter_v

<%= javascript_include_tag “application” %>

That line worked great Pete, It is all sorted now.

Just wondering why it works with the “application” and not the :all?

Thanks.