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?!? :) 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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2009-Feb-04 09:51 UTC
Re: Every controller action is being process twice, help!
Show your layout Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 04/02/2009, at 3:54 PM, ghettoiam <iamghetto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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?!? :) > > 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! > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---