[Mongrel] Mongrel script and config options

Luis Lavena luislavena at gmail.com
Tue Apr 13 18:35:29 EDT 2010

On Tue, Apr 13, 2010 at 7:25 PM, Pete <pete at kapiti.co.nz> wrote:
> Interesting is also this page http://guides.rails.info/configuring.html
> which states under "2.Running Code Before Rails": To run some code before
> Rails itself is loaded, simply put it above the call to require 'rails/all'
> in your application.rb.
> If I log boot strapping of rails, I get this different sequences:
> when using mongrel via script/server (notice boot.rb appears twice!!!):
>  boot.rb
>  environment.rb
>  boot.rb
>  application.rb
> when using mongrel via mongrel_rails:
>  environment.rb
>  boot.rb
>  application.rb
> Note that while the latter option is the common way to start the
> application, the former option is what I must use to debug my rails
> application under Netbeans.

I would avoid script/server as it loads mongrel incorrectly.

> So clearly, running code (that fetches custom specific command line options)
> before rails starts doesn't work well with either environment, let alone
> both.

Can I know how are you doing it?

> I've even tried to place such code inside environment.rb which is clearly
> loaded before application.rb and still had no luck.

Which part? the top? the bottom? Which version of rails?

If you place the code in config/preinitializer.rb it will be loaded
before environment.rb fully loads.

> So far, the only way that worked for me is to modify library code and this
> is something a dread.

Please be more specific with the examples. Show us code so we can
replicate and workout solutions.

You can't supply command line options to mongrel_rails that are not
supported, however, you can use either environment variables or other

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Mongrel-users mailing list