# Every controller action is being process twice, help!

**URL:** <https://www.ruby-forum.com/t/every-controller-action-is-being-process-twice-help/159410>\
**Category:** Rails\
**Created:** [February 4, 2009, 10:27am UTC](https://www.ruby-forum.com/t/every-controller-action-is-being-process-twice-help/159410 "2009-02-04T10:27:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghettoiam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e95f7d/32.png) [@ghettoiam](https://www.ruby-forum.com/u/ghettoiam)\
**Post date:** [February 4, 2009, 10:27am UTC](https://www.ruby-forum.com/t/every-controller-action-is-being-process-twice-help/159410/1 "2009-02-04T10:27:43Z")

</div>

Regardless of what action in what controller I hit, the server is  
executing the whole controller twice, sequentially.

It’s goes through it once, then it goes through it again, then it  
shows page.

Here is an example of output from webrick:

127.0.0.1 - - [03/Feb/2009:21:42:56 Mountain Standard Time] “GET /  
contact/ HTTP/1.1” 200 22511

- → /contact/  
127.0.0.1 - - [03/Feb/2009:21:42:56 Mountain Standard Time] “GET /  
contact/ HTTP/1.1” 304 0  
[http://localhost:3000/contact/](http://localhost:3000/contact/) → /schedules/

I go to localhost:3000/contact then it is instantly reloaded again.  
The 304 means the content has not changed.

WHAT IS CAUSING THIS TO HAPPEN?!? 🙂

It will happen with the actions/controller below.

class PagesController \< ApplicationController

def contact  
end

def about  
end

end

I’d appreciate sound guidance as to where I should be looking in my  
code to solve this problems. It happens on dev and in prod which are  
two completely different environments.

I’ll include my code from some common files where I’d think this  
problem comes from, though I suspect it’s something uncommon.

if I render :text =\> “foo” in a controller, it is not hit twice.

===== application.rb

class ApplicationController \< ActionController::Base  
helper :all # include all helpers, all the time  
include AuthenticatedSystem  
include RestfulTransform

#layout proc{ |c| c.request.xhr? ? false : “application” }

protect\_from\_forgery  
end

===== environment.rb

RAILS\_GEM\_VERSION = ‘2.2.2’ unless defined? RAILS\_GEM\_VERSION

require File.join(File.dirname( **FILE** ), ‘boot’)  
ENV[‘INLINEDIR’] = File.join(RAILS\_ROOT, ‘tmp’, ‘ruby\_inline’)

Rails::Initializer.run do |config|  
config.action\_controller.session = {  
:session\_key =\> ‘\_mma\_session’,  
:secret =\>  
‘3e0a8bbd240cc29aaa38fb04bad7452ee793ee6884d0a9ac0b0dceee06eb0bbdf6aa07ed9453ac346c160e0e624f583dbb5cdf6d7ac618c5472ce25076650d8b’  
}  
config.active\_record.observers = :user\_observer

end

THANK YOU VERY MUCH FOR ANY HELP!

---

<div class="post-metadata">

**Author:** ![ghettoiam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e95f7d/32.png) [@ghettoiam](https://www.ruby-forum.com/u/ghettoiam)\
**Post date:** [February 4, 2009, 10:51am UTC](https://www.ruby-forum.com/t/every-controller-action-is-being-process-twice-help/159410/2 "2009-02-04T10:51:50Z")

</div>

Show your layout

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)
