I've set the RAILS_ROOT to absolute path inside boot.rb, for older apps
this needs to be done manually replacing

  RAILS_ROOT = root_path

with

  RAILS_ROOT = File.expand_path(root_path)

And class auto loading will work after chdir() too. I've submited this in
ticket #4045.

As for mysql: new database connection is needed after forking. My
refresher.rb now looks:

Kernel.daemonize
ActiveRecord::Base.establish_connection

The second line can be avoided if no AR class was encountered till that
point. But it cant hurt to write it down anyway. Does this qualify for a
no-brain solution?

Or should it be more creative, letting AR reconnect automatically once
after fork? I think this could be perhaps too much magic. Mysql handles
are just one kind of resources that cannot be shared.

Zsombor

-- 
Company  - http://primalgrasp.com
Thoughts - http://deezsombor.blogspot.com

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to