diff --git a/guides/source/initialization.textile b/guides/source/initialization.textile index 78790a5e3c..5ce8173e85 100644 --- a/guides/source/initialization.textile +++ b/guides/source/initialization.textile @@ -410,7 +410,7 @@ instance of +ActiveSupport::Logger+. The +super+ method will call +Rack::Server.start+ which begins its definition like this: -def start +def start &blk if options[:warn] $-w = true end @@ -430,22 +430,37 @@ def start pp wrapped_app pp app end + + check_pid! if options[:pid] + + # Touch the wrapped app, so that the config.ru is loaded before + # daemonization (i.e. before chdir, etc). + wrapped_app + + daemonize_app if options[:daemonize] + + write_pid if options[:pid] + + trap(:INT) do + if server.respond_to?(:shutdown) + server.shutdown + else + exit + end + end + + server.run wrapped_app, options, &blk end -In a Rails application, these options are not set at all and therefore aren't used at all. The first line of code that's executed in this method is a call to this method: - - -wrapped_app - - -This method calls another method: +The interesting part for a Rails app is the last line, +server.run+. Here we encounter the +wrapped_app+ method again, which this time +we're going to explore more. @wrapped_app ||= build_app app -Then the +app+ method here is defined like so: +The +app+ method here is defined like so: def app