Forum: Ruby on Rails Configs not loading

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.
Wuher (Guest)
on 2006-06-02 09:34
(Received via mailing list)
Hi,
So in the past I've developed using Apache 2.0 MacOSX.  I've just
started a
new project and decided to switch over to LightTPD just to try it out.
This
development is purely a learning endevor for me, so I welcome the idea
of
stepping into new territory.  As a result, I'm not sure if this is a
lighttpd problem or a Rails one.  So pardon me if this is off topic to
this
mailing list.

On apache, everytime I made a new request, my environments.rb file would
be
reloaded.  So once I made a change to that file, all I'd have to do is
make
a new request.  Now, since I've changed to lighttpd (or simply started
this
new project), I've noticed that it seems to only get loaded at startup.
I
have to restart the server in order for any of my changes to be
reflected.

Speaking of which.  The only way I know how to restart the server if by
killing the process directly.  Is there any easier way?

Thanks,
Ryan
--
View this message in context:
http://www.nabble.com/Configs-not-loading-t1720938...
Sent from the RubyOnRails Users forum at Nabble.com.
Tom M. (Guest)
on 2006-06-02 20:00
(Received via mailing list)
Assuming you're using FCGI, do you have a line in your lighty config
that
looks like this?

          "bin-environment" => ("RAILS_ENV" => "development")

--
-- Tom M.
Wuher (Guest)
on 2006-06-02 20:58
(Received via mailing list)
Yes.  That's how I noticed the problem actually.  I uncommented the
line:

# ENV['RAILS_ENV'] ||= 'production'

In my environments.rb file, but it remained in development mode until I
restarted the server.  I'm also using a localization plugin, and the
line:

Localization::load_localized_strings

which does that obvious, only runs at startup as well.  So if I make a
change to my localized strings file, it isn't reflected until I restart
the
server.  It's definitely not ideal.

Thanks,
Ryan


Tom M. wrote:
> On Jun 1, 2006, at 10:33 PM, Wuher wrote:
>> mailing list.
>> reflected.
>> Sent from the RubyOnRails Users forum at Nabble.com.
>
>
--
View this message in context:
http://www.nabble.com/Configs-not-loading-t1720938...
Sent from the RubyOnRails Users forum at Nabble.com.
Alex W. (Guest)
on 2006-06-02 21:27
Wuher wrote:
> Yes.  That's how I noticed the problem actually.  I uncommented the
> line:
>
> # ENV['RAILS_ENV'] ||= 'production'
>
> In my environments.rb file, but it remained in development mode until I
> restarted the server.  I'm also using a localization plugin, and the
> line:
>
> Localization::load_localized_strings
>
> which does that obvious, only runs at startup as well.  So if I make a
> change to my localized strings file, it isn't reflected until I restart
> the
> server.  It's definitely not ideal.
>
> Thanks,
> Ryan
>
>
> Tom M. wrote:
>> On Jun 1, 2006, at 10:33 PM, Wuher wrote:
>>> mailing list.
>>> reflected.
>>> Sent from the RubyOnRails Users forum at Nabble.com.
>>
>>
> --
> View this message in context:
> http://www.nabble.com/Configs-not-loading-t1720938...
> Sent from the RubyOnRails Users forum at Nabble.com.

That's just how it works.  Switching your environment only works when
the app is loaded.  With lighttpd/fcgi the app then stays in memory
ready to process requests.  There are even some things that don't get
reloaded in development mode.

One thing you can do is if you have class you want reloaded in
development mode simply

  class Foo
    include Reloadable
  end

It was probably reloading everything in apache because you wwere
probably using cgi, which loads, processes, and quits the app for every
single request, meaning all files are reloaded every request no matter
what.  With fcgi the app is only loaded once.
This topic is locked and can not be replied to.