From 49bc6a249e2a200216f8a96c36093a2c7a471c9b Mon Sep 17 00:00:00 2001 From: Craig R Webster Date: Sun, 21 Mar 2010 19:35:38 +0000 Subject: Allow customisation of asset path generation using a proc. Set config.action_controller.asset_path_template to a proc that takes one argument - the direct, unchanged asset path - and returns a path to that asset using the scheme that your assets require. This is useful if you have a setup which scales by introducing new application servers where the mtime of the asset files may not be the same as those of the asset files on your previous servers, but it does require your web servers to have knowledge of the asset template paths that you rewrite to so it's not suitable for out-of-the-box use. An example of configuring asset path generation and rewriting these paths using Apache is included in actionpack/lib/action_view/helpers/asset_tag_helper.rb. Signed-off-by: wycats --- railties/guides/source/configuring.textile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/guides/source') diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 5418ad7dd4..e438d4cc0a 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -133,6 +133,8 @@ h4. Configuring Action Controller * +config.action_controller.asset_host+ provides a string that is prepended to all of the URL-generating helpers in +AssetHelper+. This is designed to allow moving all javascript, CSS, and image files to a separate asset host. +* +config.action_controller.asset_template_path+ allows you to override the default asset path generation by providing your own instructions. + * +config.action_controller.consider_all_requests_local+ is generally set to +true+ during development and +false+ during production; if it is set to +true+, then any error will cause detailed debugging information to be dumped in the HTTP response. For finer-grained control, set this to +false+ and implement +local_request?+ to specify which requests should provide debugging information on errors. * +config.action_controller.allow_concurrency+ should be set to +true+ to allow concurrent (threadsafe) action processing. Set to +false+ by default. You probably don't want to call this one directly, though, because a series of other adjustments need to be made for threadsafe mode to work properly. Instead, you should simply call +config.threadsafe!+ inside your +production.rb+ file, which makes all the necessary adjustments. -- cgit v1.2.3 From 201e8986b15f4d815355e0ca96e02cf16dba9372 Mon Sep 17 00:00:00 2001 From: wycats Date: Sun, 28 Mar 2010 18:45:52 -0700 Subject: Updated asset_template_path to asset_path and have it also support a String [#4247 state:resolved] --- railties/guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index e438d4cc0a..e35126fc5a 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -133,7 +133,7 @@ h4. Configuring Action Controller * +config.action_controller.asset_host+ provides a string that is prepended to all of the URL-generating helpers in +AssetHelper+. This is designed to allow moving all javascript, CSS, and image files to a separate asset host. -* +config.action_controller.asset_template_path+ allows you to override the default asset path generation by providing your own instructions. +* +config.action_controller.asset_path+ allows you to override the default asset path generation by providing your own instructions. * +config.action_controller.consider_all_requests_local+ is generally set to +true+ during development and +false+ during production; if it is set to +true+, then any error will cause detailed debugging information to be dumped in the HTTP response. For finer-grained control, set this to +false+ and implement +local_request?+ to specify which requests should provide debugging information on errors. -- cgit v1.2.3 From bd69589143371254b6d71aa74b1230144eb30a9c Mon Sep 17 00:00:00 2001 From: wycats Date: Sun, 28 Mar 2010 19:07:50 -0700 Subject: preinitializer.rb is no longer needed, so remove it from the guide and replace with better suggestion. [#4279 state:resolved] --- railties/guides/source/configuring.textile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index e35126fc5a..55077bcd24 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -9,24 +9,24 @@ endprologue. h3. Locations for Initialization Code -Rails offers (at least) five good spots to place initialization code: +Rails offers (at least) four good spots to place initialization code: -* Preinitializers -* environment.rb +* application.rb * Environment-specific Configuration Files * Initializers (load_application_initializers) * After-Initializers -h3. Using a Preinitializer +h3. Running Code Before Rails -Rails allows you to use a preinitializer to run code before the framework itself is loaded. If you save code in +RAILS_ROOT/config/preinitializer.rb+, that code will be the first thing loaded, before any of the framework components (Active Record, Action Pack, and so on.) If you want to change the behavior of one of the classes that is used in the initialization process, you can do so in this file. +To run some code before Rails itself is loaded, simply put it above the call to ++require 'rails/all'+ in your +application.rb+. h3. Configuring Rails Components -In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The +environment.rb+ and environment-specific configuration files (such as +config/environments/production.rb+) allow you to specify the various settings that you want to pass down to all of the components. For example, the default Rails 2.3 +environment.rb+ file includes one setting: +In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The +application.rb+ and environment-specific configuration files (such as +config/environments/production.rb+) allow you to specify the various settings that you want to pass down to all of the components. For example, the default Rails 2.3 +application.rb+ file includes one setting: -config.time_zone = 'UTC' +config.filter_parameters << :password This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same +config+ object: @@ -53,8 +53,6 @@ h4. Rails General Configuration * +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. All elements of this array must also be in +load_paths+. -* +config.frameworks+ accepts an array of rails framework components that should be loaded. (Defaults to +:active_record+, +:action_controller+, +:action_view+, +:action_mailer+, and +:active_resource+). - * +config.load_once_paths+ accepts an array of paths from which Rails will automatically load from only once. All elements of this array must also be in +load_paths+. * +config.load_paths+ accepts 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. -- cgit v1.2.3