Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 226
- Log:
When running Rake tasks, the use of PATH_PREFIX in routes.rb causes
problems. The routes get parsed but unless RAILS_RELATIVE_URL_ROOT is
set in the environment, they fail because PATH_PREFIX ends up 'nil'
and you can't add 'nil' to a string. Up until now I've just set the
environment variable to an empty string (any defined value will do)
and started again, but this is pretty stupid. A far simpler approach
is to just define PATH_PREFIX to an empty string if the enviroment
variable is missing, allowing rake tasks to run without extra work.Modified environment.rb to do this in all cases, including patching
old applications that aren't used, in case they're ever used again.
- Author:
- rool
- Date:
- Wed Jun 13 18:00:17 +0100 2007
- Size:
- 3415 Bytes
1 | # Be sure to restart your web server when you modify this file. |
2 | |
3 | # Rails Gem Version |
4 | # RAILS_GEM_VERSION = '1.1.2' |
5 | |
6 | # Uncomment below to force Rails into production mode when |
7 | # you don't control web/app server and can't set it the proper way |
8 | # ENV['RAILS_ENV'] ||= 'production' |
9 | |
10 | # Bootstrap the Rails environment, frameworks, and default configuration |
11 | require File.join(File.dirname(__FILE__), 'boot') |
12 | |
13 | # Location of application relative to document root in terms of |
14 | # URLs (i.e. according to the web server configuration, not the |
15 | # filesystem location). Location of that server document root, as |
16 | # a physical path. |
17 | |
18 | PATH_PREFIX = ENV['RAILS_RELATIVE_URL_ROOT'] || '' |
19 | PATH_TO_DOCUMENT_ROOT = ENV['SERVER_DOCUMENT_ROOT'] |
20 | |
21 | require 'radius' |
22 | |
23 | Rails::Initializer.run do |config| |
24 | # We don't run in the document root, so images etc. must come from |
25 | # a non-root location too. Hijack the 'asset host' facility to get |
26 | # helper-based links pointing in the right place. |
27 | config.action_controller.asset_host = PATH_PREFIX |
28 | |
29 | # Settings in config/environments/* take precedence those specified here |
30 | |
31 | # Skip frameworks you're not going to use |
32 | config.frameworks -= [ :action_web_service, :action_mailer ] |
33 | |
34 | # Add additional load paths for when Radiant is running in instance mode |
35 | config.load_paths += %w( |
36 | app/controllers |
37 | app/models |
38 | app/helpers |
39 | app/behaviors |
40 | app/filters |
41 | lib |
42 | ).map { |path| File.join(RADIANT_ROOT, path) } |
43 | config.controller_paths << File.join(RADIANT_ROOT, 'app', 'controllers') |
44 | config.view_path = File.join(RADIANT_ROOT, 'app', 'views') |
45 | |
46 | # Force all environments to use the same logger level |
47 | # (by default production uses :info, the others :debug) |
48 | config.log_level = :warn |
49 | |
50 | # Use the database for sessions instead of the file system |
51 | # (create the session table with 'rake create_sessions_table') |
52 | # config.action_controller.session_store = :active_record_store |
53 | |
54 | # Enable page/fragment caching by setting a file-based store |
55 | # (remember to create the caching directory and make it readable to the application) |
56 | # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/fragment_cache" |
57 | config.action_controller.page_cache_directory = "#{RAILS_ROOT}/cache" |
58 | |
59 | # Make Active Record use UTC-base instead of local time |
60 | config.active_record.default_timezone = :utc |
61 | |
62 | # Make sure plugins are loaded from lib and vendor |
63 | config.plugin_paths = ["#{RAILS_ROOT}/vendor/plugins", "#{RADIANT_ROOT}/lib/plugins", |
64 | "#{RADIANT_ROOT}/vendor/plugins"] |
65 | |
66 | # See Rails::Configuration for more options |
67 | end |
68 | |
69 | # Allow multiple Rails applications by giving the session cookie a |
70 | # unique prefix. |
71 | |
72 | ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = 'radiantapp_session_id' |
73 | |
74 | # Add new inflection rules using the following format: |
75 | Inflector.inflections do |inflect| |
76 | inflect.uncountable 'config' |
77 | end |
78 | |
79 | # Auto-require text filters |
80 | Dir["#{RADIANT_ROOT}/app/filters/*_filter.rb"].each do |filter| |
81 | require_dependency filter |
82 | end |
83 | |
84 | # Auto-require behaviors |
85 | Dir["#{RADIANT_ROOT}/app/behaviors/*_behavior.rb"].each do |behavior| |
86 | require_dependency behavior |
87 | end |
88 | |
89 | # Response Caching Defaults |
90 | ResponseCache.defaults[:directory] = ActionController::Base.page_cache_directory |
91 | ResponseCache.defaults[:logger] = ActionController::Base.logger |
92 | |
93 | # Activate observers that should always be running |
94 | ActiveRecord::Base.observers = :user_action_observer |