Every controller action is being process twice, help!


#1

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/ -> /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?!? :slight_smile:

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!


#2

Show your layout

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/