Search code examples
javascriptruby-on-railsrubyconfirm

Unable to delete and display confirm box


I am unable to delete or display a confirm box in Rails 3.1.

I have the following lines in my application.hmtl.erb layout :

<%= stylesheet_link_tag  "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>

I have also tried to change "application" to :defaults or "prototype" or "jquery" but it didn't change anything.

Need help with this !


Solution

  • Confirm boxes and routing to REST actions are done by the the unobtrusive javascript file. You have this problem, because you don't have it included.

    Check inside your application.js if you have the following lines (before any actual javascript code):

    //= require jquery
    //= require jquery_ujs
    

    This example assumes that you have the jquery-rails gem in your Gemfile. If you have prototype-rails, you should switch to:

    //= require prototype
    //= require prototype_ujs