Skip to content

Instantly share code, notes, and snippets.

@8th-Light-Blog
Created June 28, 2011 14:59
Show Gist options
  • Save 8th-Light-Blog/1051319 to your computer and use it in GitHub Desktop.
Save 8th-Light-Blog/1051319 to your computer and use it in GitHub Desktop.
Blog Title: One Take on Configuring Rails Routes and asset_host (Part 1)
Author: Jim Suchy
Date: December 2nd, 2008
/deployment
/deployment/system_one
/deployment/system_one/etc
/deployment/system_one/etc/config.rb
/deployment/system_one/rails_app_one
/deployment/system_one/non_rails_subsystem_one
APPLICATION_CONFIGURATION ||= {}
APPLICATION_CONFIGURATION[:foo] = "bar"
# Load the system configuration
require File.expand_path("/deployment/system_one/etc/config")
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
deployment/config
deployment/config/server_config.rb
# Allow for configuration to be overridden by
# a config file that is not under source control
server_config_file = File.expand_path("/deployment/config/server_config.rb")
require server_config_file if File.exists?(server_config_file)
APPLICATION_CONFIGURATION[:my_rails_app_asset_host] = "https://www.example.com/my_rails_app/demo"
config.action_controller.asset_host = APPLICATION_CONFIGURATION[:my_rails_app_asset_host]
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id'
end
APPLICATION_CONFIGURATION[:my_rails_app_routes] = lambda do |map|
map.connect 'my_rails_app/demo/:controller/:action/:id'
map.connect 'my_rails_app/demo', :controller => "login", :action => "index"
map.login 'my_rails_app/demo/login', :controller => "login", :action => "index"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment