# One Request but Double Processing

**URL:** <https://www.ruby-forum.com/t/one-request-but-double-processing/180134>\
**Category:** Rails\
**Created:** [December 12, 2009, 3:21pm UTC](https://www.ruby-forum.com/t/one-request-but-double-processing/180134 "2009-12-12T15:21:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkreimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@gkreimer](https://www.ruby-forum.com/u/gkreimer)\
**Post date:** [December 12, 2009, 3:21pm UTC](https://www.ruby-forum.com/t/one-request-but-double-processing/180134/1 "2009-12-12T15:21:53Z")

</div>

Hi,

one request from the browser results in double processing. If I debug,  
the corresponding controller action will be called twice. So that  
behavior isn’t a log mistake.  
Any ideas?

Here is the log file output.

Processing NoticesController#edit (for 127.0.0.1 at 2009-12-12 15:14:20)  
[GET]  
Parameters: {“action”=\>“edit”, “id”=\>“2”, “controller”=\>“notices”}  
e[4;36;1mNotice Columns (1.0ms)e[0m e[0;1mSHOW FIELDS FROM  
`notices`e[0m  
e[4;35;1mNotice Load (0.2ms)e[0m e[0mSELECT \* FROM `notices` WHERE  
(`notices`.`id` = 2) e[0m  
Rendering template within layouts/public  
Rendering notices/edit  
Completed in 32ms (View: 19, DB: 1) | 200 OK  
[[http://localhost/notices/2/edit](http://localhost/notices/2/edit)]  
e[4;36;1mSQL (0.1ms)e[0m e[0;1mSET NAMES 'utf8’e[0m  
e[4;35;1mSQL (0.1ms)e[0m e[0mSET SQL\_AUTO\_IS\_NULL=0e[0m

Processing NoticesController#edit (for 127.0.0.1 at 2009-12-12 15:14:21)  
[GET]  
Parameters: {“action”=\>“edit”, “id”=\>“2”, “controller”=\>“notices”}  
e[4;36;1mNotice Columns (1.0ms)e[0m e[0;1mSHOW FIELDS FROM  
`notices`e[0m  
e[4;35;1mNotice Load (0.1ms)e[0m e[0mSELECT \* FROM `notices` WHERE  
(`notices`.`id` = 2) e[0m  
Rendering template within layouts/public  
Rendering notices/edit  
Completed in 23ms (View: 11, DB: 1) | 200 OK  
[[http://localhost/notices/2/edit](http://localhost/notices/2/edit)]

---

<div class="post-metadata">

**Author:** ![gkreimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@gkreimer](https://www.ruby-forum.com/u/gkreimer)\
**Post date:** [December 12, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/one-request-but-double-processing/180134/2 "2009-12-12T17:10:47Z")

</div>

Georg Kuffer wrote:

> Hi,
> 
> one request from the browser results in double processing. If I debug,  
> the corresponding controller action will be called twice. So that  
> behavior isn’t a log mistake.  
> Any ideas?

Not until you provide the controller code.

Best,  
–Â  
MarnenÂ Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![gkreimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@gkreimer](https://www.ruby-forum.com/u/gkreimer)\
**Post date:** [December 12, 2009, 8:19pm UTC](https://www.ruby-forum.com/t/one-request-but-double-processing/180134/3 "2009-12-12T20:19:04Z")

</div>

Marnen Laibow-Koser wrote:

> Georg Kuffer wrote:
> 
> > Hi,
> > 
> > one request from the browser results in double processing. If I debug,  
> > the corresponding controller action will be called twice. So that  
> > behavior isn’t a log mistake.  
> > Any ideas?
> 
> Not until you provide the controller code.
> 
> Best,  
> –Â  
> MarnenÂ Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

Now I attached the Application and Notice Controller.

---

<div class="post-metadata">

**Author:** ![gkreimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@gkreimer](https://www.ruby-forum.com/u/gkreimer)\
**Post date:** [December 13, 2009, 2:53pm UTC](https://www.ruby-forum.com/t/one-request-but-double-processing/180134/4 "2009-12-13T14:53:20Z")

</div>

Georg Kuffer wrote:

> Hi,
> 
> one request from the browser results in double processing. If I debug,  
> the corresponding controller action will be called twice. So that  
> behavior isn’t a log mistake.  
> Any ideas?
> 
> Here is the log file output.
> 
> Processing NoticesController#edit (for 127.0.0.1 at 2009-12-12 15:14:20)  
> [GET]  
> Parameters: {“action”=\>“edit”, “id”=\>“2”, “controller”=\>“notices”}  
> e[4;36;1mNotice Columns (1.0ms)e[0m e[0;1mSHOW FIELDS FROM  
> `notices`e[0m  
> e[4;35;1mNotice Load (0.2ms)e[0m e[0mSELECT \* FROM `notices` WHERE  
> (`notices`.`id` = 2) e[0m  
> Rendering template within layouts/public  
> Rendering notices/edit  
> Completed in 32ms (View: 19, DB: 1) | 200 OK  
> [[http://localhost/notices/2/edit](http://localhost/notices/2/edit)]  
> e[4;36;1mSQL (0.1ms)e[0m e[0;1mSET NAMES 'utf8’e[0m  
> e[4;35;1mSQL (0.1ms)e[0m e[0mSET SQL\_AUTO\_IS\_NULL=0e[0m
> 
> Processing NoticesController#edit (for 127.0.0.1 at 2009-12-12 15:14:21)  
> [GET]  
> Parameters: {“action”=\>“edit”, “id”=\>“2”, “controller”=\>“notices”}  
> e[4;36;1mNotice Columns (1.0ms)e[0m e[0;1mSHOW FIELDS FROM  
> `notices`e[0m  
> e[4;35;1mNotice Load (0.1ms)e[0m e[0mSELECT \* FROM `notices` WHERE  
> (`notices`.`id` = 2) e[0m  
> Rendering template within layouts/public  
> Rendering notices/edit  
> Completed in 23ms (View: 11, DB: 1) | 200 OK  
> [[http://localhost/notices/2/edit](http://localhost/notices/2/edit)]

I found the problem. It was a beginners mistake.  
I work with JQuery. There were the following lines in the application.js  
(I put it with the copy and paste and don’t think:))  
$.ajax({  
beforeSend: function(){  
$(“#ajax\_flash”).html(“Wird geladen…”);  
},  
complete: function(){  
$(“#ajax\_flash”).html(“”);  
},  
error: function(){  
$(“#ajax\_flash”).html(“Verbindungsfehler mit dem Server.”);  
}  
});  
This lines causes an additional ajax request on every “normal” http  
request.  
Maybe I can help someone else with this fact.
