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.
2c3e9116fabc3e9f09927d1ffa8bf9e3?d=identicon&s=25 Wuher (Guest)
on 2006-06-02 07: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.
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-06-02 18: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 Mornini
2c3e9116fabc3e9f09927d1ffa8bf9e3?d=identicon&s=25 Wuher (Guest)
on 2006-06-02 18: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 Mornini 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.
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-06-02 19: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 Mornini 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.