cheat sheets.

$ cheat rails_configuration
General options
---------------

All of these options can be accessed directly on the config object inside an
Initializer block (ie production.rb). For example in your environment.rb:

  Rails::Initializer.run do |config|
    ...
    config.frameworks -= [ :active_resource ]
    ...
  end
  

cache_classes
    Whether or not classes should be cached (set to false if you want
    application classes to be reloaded on each request)

cache_store
    The specific cache store to use. By default, the 
    ActiveSupport::Cache::Store will be used.

controller_paths
    The list of paths that should be searched for controllers. (Defaults
    to <tt>app/controllers</tt> and <tt>components</tt>.)

database_configuration_file
    The path to the database configuration file to use. (Defaults to
    <tt>config/database.yml</tt>.)

frameworks
    The list of rails framework components that should be loaded. (Defaults
    to <tt>:active_record</tt>, <tt>:action_controller</tt>,
    <tt>:action_view</tt>, <tt>:action_mailer</tt>, and
    <tt>:active_resource</tt>).

gem
    Adds a single Gem dependency to the rails application.

      # gem 'aws-s3', '>= 0.4.0'
      # require 'aws/s3'
      config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \
        :source => "http://code.whytheluckystiff.net"

gems
    An array of gems that this rails application depends on.  Rails will
    automatically load these gems during installation, and allow you to install
    any missing gems with:

      rake gems:install

    You can add gems with the #gem method.

load_paths
    An array of additional paths to prepend to the load path. By default,
    all +app+, +lib+, +vendor+ and mock paths are included in this list.

load_once_paths
    An array of paths from which Rails will automatically load from only once.
    All elements of this array must also be in +load_paths+.

log_level
    The log level to use for the default Rails logger. In production mode,
    this defaults to <tt>:info</tt>. In development mode, it defaults to
    <tt>:debug</tt>.

log_path
    The path to the log file to use. Defaults to log/    #{environment}.log
    (e.g. log/development.log or log/production.log).

logger
    The specific logger to use. By default, a logger will be created and
    initialized using #log_path and #log_level, but a programmer may
    specifically set the logger to use via this accessor and it will be
    used directly.

plugin_paths
    The path to the root of the plugins directory. By default, it is in
    <tt>vendor/plugins</tt>.

plugin_locators
    The classes that handle finding the desired plugins that you'd like to load
    for your application. By default it is the Rails::Plugin::FileSystemLocator
    which finds plugins to load in <tt>vendor/plugins</tt>. You can hook into
    gem location by subclassing Rails::Plugin::Locator and adding it onto the
    list of <tt>plugin_locators</tt>.

plugin_loader
    The class that handles loading each plugin. Defaults to 
    Rails::Plugin::Loader, but a sub class would have access to fine grained
    modification of the loading behavior. See the implementation of 
    Rails::Plugin::Loader for more details.

reload_plugins
    Enables or disables plugin reloading.  You can get around this setting per 
    plugin. If #reload_plugins? == false, add this to your plugin's init.rb to
    make it reloadable:

      Dependencies.load_once_paths.delete lib_path

    If #reload_plugins? == true, add this to your plugin's init.rb to only load
    it once:

      Dependencies.load_once_paths << lib_path

view_path
    The root of the application's views. (Defaults to <tt>app/views</tt>.)

whiny_nils
    Set to +true+ if you want to be warned (noisily) when you try to invoke
    any method of +nil+. Set to +false+ for the standard Ruby behavior.


ActiveRecord Options
--------------------

Each of these options should be prepended with config.active_record. when used
with a Rails::Initializer do |config| block.

primary_key_prefix_type
    Accessor for the prefix type that will be prepended to every primary key
    column name. The options are :table_name and :table_name_with_underscore. If
    the first is specified, the Product class will look for “productid”
    instead of “id” as the primary column. If the latter is specified, the
    Product class will look for “product_id” instead of “id”. Remember
    that this is a global setting for all Active Records.
table_name_prefix
    The string to prepend to every table name.
    By default, the prefix is an empty string
table_name_suffix
    The same as table_name_prefix, but it appends the string to the table name.
pluralize_table_names
    Indicates whether or not table names should be the pluralized versions of
    the corresponding class names.
    Defaults to true.
colorize_logging
    Should logs have ANSI color codes in logging statments?
    Defaults to true
default_timezone
    Determines whether to use Time.local (using :local) or Time.utc (using :utc)
    when pulling dates and times from the database.
    Defaults to :local by default.
allow_concurrency
    Determines whether or not to use a connection for each thread, or a single
    shared connection for all threads.
    Defaults to false. Set to true if you’re writing a threaded application.
generate_read_methods
    Determines whether to speed up access by generating optimized reader methods
    to avoid expensive calls to method_missing when accessing attributes by
    name. You might want to set this to false in development mode, because the
    methods would be regenerated on each request.
schema_format
    Specifies whether to dump the database in ruby or sql. It takes :ruby or
    :sql as options, and defaults to :ruby


ActionController Options
------------------------

Each of these options should be prepended with config.action_controller. when
used with a Rails::Initializer do |config| block.

view_controller_internals
    Determines whether the view has access to controller internals @request,
    @response, @session, and @template.
assert_host
    Prepends all the URL-generating helpers from AssetHelper (eg. image_tag)
consider_all_requests_local
    All requests are considered local by default (true), so everyone will be
    exposed to detailed debugging screens on errors.
    Defaults to true
debug_routes
    Enable or disable the collection of failure information for RoutingErrors.
    Defaults to true.
allow_concurrency
    Controls whether the application is thread-safe.
    Defaults to false.
param_parsers
    Lets you register handlers wich will process the http body and add
    parameters to the @params hash.
    Defaults to { Mime::XML => :xml_simple }
template_root
    Sets the default template location. For example, a call to
    render("test/template") will be converted to
    "#{template_root}/test/template.rhtml"
logger
    Can be set to nil for no logging or a logger conforming to the interface of
    Log4r or the default Ruby 1.8+ Logger class.
ignore_missing_templates
    Turn on ignore_missing_templates if you want to unit test actions without
    making the associated templates.


ActionView Options
------------------

Each of these options should be prepended with config.action_view. when used
with a Rails::Initializer do |config| block.

cache_template_loading
    Specify whether file modification times should be checked to see if a
    template needs recompilation
cache_template_extensions
    Specify whether file extension lookup should be cached. Should be false for
    development environments.
    Defaults to true.
local_assigns_support_string_keys
    Specify whether local_assigns should be able to use string keys.
    Defaults to true.
    String keys are deprecated and will be removed shortly.
debug_rjs
    Specify whether RJS responses should be wrapped in a try/catch block that
    alert()s the caught exception (and then re-raises it).
    Defaults to false.
logger
    Can be set to nil for no logging or a logger conforming to the interface of
    Log4r or the default Ruby 1.8+ Logger class.


ActionMailer Options
--------------------

Each of these options should be prepended with config.action_mailer. when used
with a Rails::Initializer do |config| block.

server_settings
    A hash defining the server to be used for email.
    Defaults to using a server localy on port 25 as such:

    { :address        => "localhost", 
      :port           => 25, 
      :domain         => 'localhost.localdomain', 
      :user_name      => nil, 
      :password       => nil, 
      :authentication => nil }

raise_delivery_errors
    Defaults to true
delivery_method
    Defaults to :smtp
perform_deliveries
    Defaults to true
default_charset
    Defaults to “utf-8”
default_content_type
    Defaults to “text/plain”
default_mime_version
    Defaults to nil
default_implicit_parts_order
    Defaults to [ “text/html”, “text/enriched”, “text/plain” ]


Original information taken from
http://glu.ttono.us/articles/2006/05/22/configuring-rails-environments-the-cheat-
heet
Version 1, updated 1048 days ago.
. o 0 ( edit | history )
( add new | see all )