Delete link in Rails 3

Closing in steadily on my Rails 3 upgrade. I can see the finish line. A few more wrinkles to iron out.

My Rails app uses jQuery and Haml. I downloaded the rails.js and put it in my application.html.haml as I show below:

!!!

%html{:lang => "en"}

  %head

    %meta{"http-equiv"=>"Content-Type", :content=>"text/html;charset=utf-8"}

    %title

      The Internet File Manager

    = stylesheet_link_tag 'web_app_theme', "themes/#{@current_theme}/style", 'web_app_theme_ext','ui.theme.css', 'ui.core.css', 'ui.accordion.css','jquery.cluetip.css'

    = javascript_include_tag "jquery.js", "rails.js", "jquery-ui.js", "jquery.hoverIntent.js", "jquery.cluetip.js", "application.js"

    = csrf_meta_tag

  %body

   ......

The delete link has the usual code:

= link_to 'Delete', {:controller => controller_name, :action => 'destroy', :id => rec.id} , :confirm => 'Are you sure?', :method => :delete

This is generic code where I pass-in the controller name.

This does not do what it is supposed to instead takes me to the show action as shown below:

Template is missing

Missing template clients/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/bruparel/rr_work/file_manager/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/stump/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/ssl_requirement/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/rails_upgrade/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/navigation/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/haml/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/dynamic_form/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/custom-err-msg/app/views", "/home/bruparel/rr_work/file_manager/vendor/plugins/acts_as_tree/app/views"

I am not sure how to attack this one?

Thanks in advance for your help.

Bharat

check your app/config/routes.rb (with precedence)

by Thaniyarasu

Hello Thani, I tried that, but no luck. The edit link that goes with delete link works fine. It is shown below:

= link_to 'Edit', :controller => controller_name, :action => 'edit', :id => rec.id

Corresponding routes.rb file snippet is shown below: ...   resources :clients do     member do       get :set_current_client     end   end ...

It seems to me that it has something to do with unobstrusive jQuery interaction with HTML 5 forms since the only link that misbehaves is the delete/destroy link? Thanks. Bharat

Please disregard. It turns out that I was using the wrong rails.js file with jQuery plus the wrong version of jQuery. Please watch the latest RailsCast from Ryan Bates to get around this problem. Thanks. Bharat