# Strange Problem with ActionController (I think)

**URL:** <https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436>\
**Category:** Rails\
**Created:** [April 3, 2006, 4:37am UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436 "2006-04-03T04:37:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 3, 2006, 4:37am UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/1 "2006-04-03T04:37:46Z")

</div>

I’m working through the Agile Depot example

I have no idea what I did, but when I try and delete something from the  
web page I get this error on the log.

Processing AdminController#destroy (for 127.0.0.1 at 2006-04-02  
22:28:06) [GET]  
Session ID: 4371bd7ca2cb5ec5e08e60a7590df90a  
Parameters: {“action”=\>“destroy”, “id”=\>“5”, “controller”=\>“admin”}  
Redirected to [http://localhost:3000/admin/list](http://localhost:3000/admin/list)  
Filter chain halted as  
[#Proc:0x013862e0@/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action\_controller/verification.rb:64]  
returned false  
Completed in 0.00135 (739 reqs/sec) | DB: 0.00000 (0%) | 302 Found  
[[http://localhost/admin/destroy/5](http://localhost/admin/destroy/5)]

If i go in using the console, I can perform product = Product.find(1);  
product.destroy; but using the browser, I can’t delete anything

I also tried using breakpoint in the destroy method in the  
ActionController, but it never seems to get triggered, in fact, I think  
the method itself never gets run… so i’m a little lost…

any help would be welcome !! 🙂

cheers

---

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 3, 2006, 6:22am UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/2 "2006-04-03T06:22:59Z")

</div>

oops, I realised I should have put this in:

my rhtml file has this:  
\<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> product },  
:confirm =\> “Are you sure?” %\>

which results in this html on the rendered page:  
[Destroy](https://www.ruby-forum.com/admin/destroy/5)

---

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 3, 2006, 6:45am UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/3 "2006-04-03T06:45:10Z")

</div>

Hi Andrew

Would you mind sharing a little code? It might be simple. Might not  
be.  
Can’t tell without seeing some code.

Best regards  
Bill  
----- Original Message -----  
From: “Andrew G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: 2006-04-02 9:37 PM  
Subject: [Rails] Strange Problem with ActionController (I think)

> Filter chain halted as

[#\<Proc:0x013862e0@/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/a  
ction\_controller/verification.rb:64\>]

---

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 4, 2006, 5:24pm UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/4 "2006-04-04T17:24:24Z")

</div>

Hi Andrew,

How did you get on ?

Alan

Alan F. wrote:

> Andrew G. wrote:
> 
> > oops, I realised I should have put this in:
> > 
> > my rhtml file has this:  
> > \<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> product },  
> > :confirm =\> “Are you sure?” %\>
> > 
> > which results in this html on the rendered page:  
> > [Destroy](https://www.ruby-forum.com/admin/destroy/5)
> 
> The block in question is this:
> 
> before\_filter(filter\_opts) do |c|  
> c.send :verify\_action, options  
> end
> 
> This is guesswork, with no 1.1 app or AWDR book, but ISTR that Rails1.1  
> puts a before\_filter in the scaffold to ensure destroy is called with a  
> :post type. ‘link\_to’ will generate a :get, which now won’t work.
> 
> Look through _your_ controller for a before\_filter which has something  
> to do with :method =\> :post and :only =\> {:destroy…}. Remove this  
> line and (if I’m right) you should be cooking.
> 
> A.

---

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 3, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/5 "2006-04-03T16:17:32Z")

</div>

Andrew G. wrote:

> oops, I realised I should have put this in:
> 
> my rhtml file has this:  
> \<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> product },  
> :confirm =\> “Are you sure?” %\>
> 
> which results in this html on the rendered page:  
> [Destroy](https://www.ruby-forum.com/admin/destroy/5)

The block in question is this:

before\_filter(filter\_opts) do |c|  
c.send :verify\_action, options  
end

This is guesswork, with no 1.1 app or AWDR book, but ISTR that Rails1.1  
puts a before\_filter in the scaffold to ensure destroy is called with a  
:post type. ‘link\_to’ will generate a :get, which now won’t work.

Look through _your_ controller for a before\_filter which has something  
to do with :method =\> :post and :only =\> {:destroy…}. Remove this  
line and (if I’m right) you should be cooking.

A.

---

<div class="post-metadata">

**Author:** ![esquilax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e0b2c6/32.png) [@esquilax](https://www.ruby-forum.com/u/esquilax)\
**Post date:** [April 7, 2006, 11:40am UTC](https://www.ruby-forum.com/t/strange-problem-with-actioncontroller-i-think/93436/6 "2006-04-07T11:40:54Z")

</div>

Hi,  
Had the same problem and removed this line of code that the scaffold  
autogenerated:

# GETs should be safe (see

[URIs, Addressability, and the use of HTTP GET and POST](http://www.w3.org/2001/tag/doc/whenToUseGet.html))  
verify :method =\> :post, :only =\> [:destroy, :create, :update],  
:redirect\_to =\> { :action =\> :list }

It’s fixed the problem for now, I’ll have to manually check all my  
controllers that are linked to a db table though.

Thanks Alan, saved me a lot of time.

Alan F. wrote:

> Hi Andrew,
> 
> How did you get on ?
> 
> Alan
> 
> Alan F. wrote:
> 
> > Andrew G. wrote:
> > 
> > > oops, I realised I should have put this in:
> > > 
> > > my rhtml file has this:  
> > > \<%= link\_to ‘Destroy’, { :action =\> ‘destroy’, :id =\> product },  
> > > :confirm =\> “Are you sure?” %\>
> > > 
> > > which results in this html on the rendered page:  
> > > [Destroy](https://www.ruby-forum.com/admin/destroy/5)
> > 
> > The block in question is this:
> > 
> > before\_filter(filter\_opts) do |c|  
> > c.send :verify\_action, options  
> > end
> > 
> > This is guesswork, with no 1.1 app or AWDR book, but ISTR that Rails1.1  
> > puts a before\_filter in the scaffold to ensure destroy is called with a  
> > :post type. ‘link\_to’ will generate a :get, which now won’t work.
> > 
> > Look through _your_ controller for a before\_filter which has something  
> > to do with :method =\> :post and :only =\> {:destroy…}. Remove this  
> > line and (if I’m right) you should be cooking.
> > 
> > A.
