# Form posts twice - once as post and again as get. Help!

**URL:** <https://www.ruby-forum.com/t/form-posts-twice-once-as-post-and-again-as-get-help/86349>\
**Category:** Ruby\
**Created:** [February 21, 2007, 5:21pm UTC](https://www.ruby-forum.com/t/form-posts-twice-once-as-post-and-again-as-get-help/86349 "2007-02-21T17:21:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [February 21, 2007, 5:21pm UTC](https://www.ruby-forum.com/t/form-posts-twice-once-as-post-and-again-as-get-help/86349/1 "2007-02-21T17:21:20Z")

</div>

Hi all,

I am posting this here #1 out of desperation and #2 on chance that this  
might be an ERB issue and ofcourse most importantly because many rails  
gurus hang out here 🙂

I am having a very strange problem. I have a search form with a bunch  
of  
fields for a db query of a table called people. The associated :person  
model has\_many sub models such as :addresses, :skills etc. The  
Person.find uses :include to eager load the data from various other  
tables which :belong\_to people.

The results page contains a form built dynamically where the user can  
select check boxes to the select persons from the result set and then  
save the set.

The problem:  
The search form is submitted and the query processed and the results  
page  
rendered. tail -f log shows…

First post:  
Processing PersonSearchController#search (for 127.0.0.1 at 2007-02-20  
13:49:28) [POST]  
Parameters: {“person\_search”=\>{“city”=\>“”, “skill\_id\_3”=\>“”,  
“skill\_search”=\>“1”,…etc, etc

…normal processing happens here till…  
Rendered person\_search/\_results (0.00915)  
Rendered layouts/\_footer (0.00027)  
Completed in 15.63002 (0 reqs/sec) | Rendering: 0.25152 (1%) | DB:  
0.02095 (0%) | 200 OK [[http://localhost/person\_search/search](http://localhost/person_search/search)]

The strange thing is that my breakpoint in the search action hits  
again immediately. And I get a second post which actually is a get.

Processing PersonSearchController#search (for 127.0.0.1 at 2007-02-20  
13:49:44) [GET]  
Session ID: 30519ded2f3bfa275e4cb7a2c1e67edc  
Parameters: {“action”=\>“search”, “controller”=\>“person\_search”}

There are no form params this time. This causes (500 Internal Error)

Relevant info:

Both the search form and the results page with the form have  
auto\_complete fields which work fine and actually use a dedicated  
auto\_completion\_controller.

Has any one seen this behaviour? Any clues/pointers will be greatly  
appreciated.

-bakki
