# Delete link in Rails 3

**URL:** <https://www.ruby-forum.com/t/delete-link-in-rails-3/193459>\
**Category:** Rails\
**Created:** [August 18, 2010, 2:56am UTC](https://www.ruby-forum.com/t/delete-link-in-rails-3/193459 "2010-08-18T02:56:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [August 18, 2010, 2:56am UTC](https://www.ruby-forum.com/t/delete-link-in-rails-3/193459/1 "2010-08-18T02:56:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [August 18, 2010, 9:40am UTC](https://www.ruby-forum.com/t/delete-link-in-rails-3/193459/2 "2010-08-18T09:40:48Z")

</div>

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

by  
Thaniyarasu

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [August 18, 2010, 4:54pm UTC](https://www.ruby-forum.com/t/delete-link-in-rails-3/193459/3 "2010-08-18T16:54:26Z")

</div>

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 B. to get around this problem.  
Thanks.  
Bharat

---

<div class="post-metadata">

**Author:** ![bruparel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e47774/32.png) [@bruparel](https://www.ruby-forum.com/u/bruparel)\
**Post date:** [August 18, 2010, 12:54pm UTC](https://www.ruby-forum.com/t/delete-link-in-rails-3/193459/4 "2010-08-18T12:54:36Z")

</div>

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
