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

          主站蜘蛛池模板: 杨浦区| 中方县| 光山县| 呈贡县| 错那县| 两当县| 响水县| 珠海市| 唐山市| 新干县| 榆中县| 沿河| 阳高县| 罗田县| 秭归县| 东莞市| 昌乐县| 涟源市| 莱西市| 康平县| 大城县| 山东| 甘洛县| 佛冈县| 翼城县| 那坡县| 胶南市| 中西区| 拉萨市| 南昌市| 会泽县| 宝坻区| 南宁市| 温宿县| 黑河市| 夹江县| 南郑县| 东城区| 苍南县| 许昌县| 固始县|