wash

          rails enviroment

          The runtime configuration of your application is performed by two files.
          One, config/environment.rb, is environment independent—it is used regardless
          of the setting of RAILS_ENV.
          The second file does depend on the environment:
          Rails looks for a file named for the current environment in the
          directory config/environments and loads it during the processing of environment.
          rb.
          The standard three environments (development.rb, production.rb,
          and test.rb) are included by default. You can add your own file if you’ve
          defined new environment types.
          Environment files typically do three things.
          ? They set up the Ruby load path. This is how your application can
          find things such as models and views when it’s running.
          ? They create resources used by your application (such as the logger).
          ? They set various configuration options, both for Rails and for your
          application.

          The first two of these are normally application-wide and so are done in
          environment.rb. The configuration options often vary depending on the environment
          and so are likely to be set in the environment-specific files in the
          environments directory.

          The Load Path
          The standard environment automatically includes the following directories
          (relative to your application’s base directory) into your application’s load
          path.
          1.?test/mocks/environment. As these are first in the load path, classes
          defined here override the real versions, enabling you to replace live
          functionality with stub code during testing. This is described starting
          on page 161.
          2.?All directories whose names start with an underscore or a lowercase
          letter under app/models and components.子目錄
          3.The directories app, app/models, app/controllers, app/helpers, app/apis,
          components, config, lib, vendor, and vendor/rails/*.
          Each of these directories is added to the load path only if it exists.

          Application-wide Resources

          environment.rb creates an instance of a Logger that will log messages to
          log/environment.log. It sets this to be the logger used by Active Record,
          Action Controller, and Action Mailer (unless your environment-specific
          configuration files had already set their own logger into any of these components).
          environment.rb also tells Action Controller and Mailer to use app/views as
          the starting point when looking for templates. Again, this can be overridden
          in the environment-specific configurations.

          Configuration Parameters
          You configure Rails by setting various options in the Rails modules. Typically
          you’ll make these settings either at the end of environment.rb (if you
          want the setting to apply in all environments) or in one of the environmentspecific
          files in the environments directory.
          We provide a listing of all these configuration parameters in Appendix B

          posted on 2006-05-10 09:41 wash 閱讀(204) 評論(0)  編輯  收藏 所屬分類: ruby rails

          主站蜘蛛池模板: 收藏| 郑州市| 民乐县| 华安县| 扬州市| 高要市| 沁源县| 郴州市| 久治县| 临西县| 五莲县| 衡南县| 宜城市| 冀州市| 新乡市| 宜阳县| 东至县| 鄂托克前旗| 南华县| 化州市| 阜南县| 固始县| 方正县| 皮山县| 芦溪县| 天水市| 繁昌县| 白银市| 海盐县| 开阳县| 乡宁县| 安远县| 化州市| 萨迦县| 新竹市| 曲阳县| 九江市| 上饶县| 平武县| 惠州市| 东阿县|