Forum: Ruby on Rails rc4 upgrade issue...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
sean (Guest)
on 2005-11-12 13:49
(Received via mailing list)
i've had the following in my environments/production.rb:

module ActionController
  module Rescue
    def local_request?
      false
    end
  end
end

As of RC4, it causes fcgi to die on startup.

can someone tell me quickly what changed to cause this
and perhaps save me some time digging through the source...
francois.beausoleil (Guest)
on 2005-11-12 13:49
(Received via mailing list)
2005/11/7, Sean T Allen <removed_email_address@domain.invalid>:
> As of RC4, it causes fcgi to die on startup.
>
> can someone tell me quickly what changed to cause this
> and perhaps save me some time digging through the source...

I don't use FCGI myself on my dev machine, but that is wrong.  You
should instead do this:

app/controllers/application.rb
class ApplicationController < ActionController::Base
protected
  def local_request?
    false
  end
end

Hope that helps !
François
sean (Guest)
on 2005-11-12 13:49
(Received via mailing list)
Francois B. wrote:

>>  end
>should instead do this:
>François
>
>
>
>
i only want it when running in production.

the code in question that always used to work actually came from DHH
quite sometime ago..

its obviusly wrong as of the 1.0 RC candidates but wasnt previously.

what you have doesnt however accomplish what i need, i.e.
only occurs when running in production.
francois.beausoleil (Guest)
on 2005-11-12 13:49
(Received via mailing list)
2005/11/8, Sean T Allen <removed_email_address@domain.invalid>:
> Francois B. wrote:
> >app/controllers/application.rb
> >class ApplicationController < ActionController::Base
> >protected
> >  def local_request?
> >    false
> >  end
> >end
> >
> i only want it when running in production.

Actually, if I remember correctly, that is exactly what's happening in
production - local_request? always returns false, no ?

Actually, I'm not quire right (Rails 0.14.3):
def local_request? #:doc:
  @request.remote_addr == "127.0.0.1"
end

As long as the request isnt come from 127.0.0.1, you should be fine in
production, no ?

Hope that helps,
François
sean (Guest)
on 2005-11-12 13:49
(Received via mailing list)
Francois B. wrote:

>>>   false
>production - local_request? always returns false, no ?
>François
>
>
It does come from 127.0.0.1

that is our setup... no requests that dont pass through a frontend
server that runs
mod_security etc etc etc
francois.beausoleil (Guest)
on 2005-11-12 13:49
(Received via mailing list)
Ah, I better understand now.  So, change my original code to this:

app/controllers/application.rb
class ApplicationController < ActionController::Base
  protected
  if 'production' == RAILS_ENV then
    def local_request?
      false
    end
  end
end

Class declarations are executable code, so it is possible to build
some stuff conditionnally.

Hope that helps !
François

2005/11/8, Sean T Allen <removed_email_address@domain.invalid>:
sean (Guest)
on 2005-11-12 13:49
(Received via mailing list)
this isnt working.

i still seems to function as tho local request where true

throwing in a random url i get:


  Routing Error

Recognition failed for "/ed"


instead of the 404.html
mtmusko (Guest)
on 2005-11-15 05:00
(Received via mailing list)
I think the problem is because of this which I found in
/actionpack-1.11.0/lib/action_controller/base.rb.

    # All requests are considered local by default, so everyone will
be exposed to detailed debugging screens on errors.
    # When the application is ready to go public, this should be set
to false, and the protected method <tt>local_request?</tt>
    # should instead be implemented in the controller to determine
when debugging screens should be shown.
    @@consider_all_requests_local = true
    cattr_accessor :consider_all_requests_local

This variable is set to false when you are in production mode so I am
guessing you are seeing this because your production.rb was not
updated to to do this.

./config/environments/production.rb:config.action_controller.consider_all_requests_local
= false

-Frank

On 11/10/05, Sean T Allen <removed_email_address@domain.invalid> wrote:
>
> >class ApplicationController < ActionController::Base
> >
> >>mod_security etc etc etc
>
>
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>
>


--
Frank K.
http://meetingkoreans.com
http://betweengo.com
sean (Guest)
on 2005-11-15 07:33
(Received via mailing list)
I have the problem because i am running lighttpd on 127.0.0.1
which the code from my original post took care of when in production...

but it doesnt work anymore...

it causes fcgi to crash

and Francois' code doesnt work.
This topic is locked and can not be replied to.