anchor.diff:  end
   
   after_fork do |server, worker|
  -  defined?(ActiveRecord::Base) and
  -  ActiveRecord::Base.establish_connection
  +  # Start up the database connection again in the worker
  +  if defined?(ActiveRecord::Base)
  +    ActiveRecord::Base.establish_connection
  +  end
  +  child_pid = server.config[:pid].sub(".pid", ".#{worker.nr}.pid")
  +  system("echo #{Process.pid} > #{child_pid}")
   end
  
positive.code: worker_processes <%= unicorn_workers %>
  timeout 120
  
  preload_app true # Мастер процесс загружает приложение, перед тем, как плодить рабочие процессы.
  
  GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=) # Решительно не уверен, что значит эта строка, но я решил ее оставить.
  
  before_exec do |server|
    ENV["BUNDLE_GEMFILE"] = "#{rails_root}/Gemfile"
  end
  
  before_fork do |server, worker|
    defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
  
    if File.exists?(old_pid) && server.pid != old_pid
      begin
        Process.kill("QUIT", File.read(old_pid).to_i)
  
negative.code: working_directory "<%= current_path %>"
  pid "<%= unicorn_pid %>"
  stderr_path "<%= unicorn_log %>"
  stdout_path "<%= unicorn_log %>"
  
  