2007-12-27 15:21:09 +0000
The Mephisto Docs tell you to put the Site.multi_sites_enabled = true into the environments files, but this is no longer true…
In fact, in the production.rb file you will find a commented out Site.multi_sites_enabled = true line. But beware Skywalker, this road leads to the dark side of tearing your hair out trying to trace an ActiveRecord::ConnectionNotEstablished error.
This is excerpted from my Rapid Development of Mostly Static Websites with Rails and Mephisto blog, I had a comment that this was a problem for someone else, so I thought I would make it easier to find.
Now, you have to tell Mephisto that you want it to run in Multisite mode, but the environment is not the place. Where to put it? In your initializers/custom.rb file! This file loads after your environments load, so jump into your favorite text editor and edit the config/initializers/custom.rb file and uncomment the line:
Site.multi_sites_enabled = true
Delete the one that is in the production.rb file.
Save the files and jump back to the command line.
Now to get the multi sites setup, from the Mephisto dir, do the following (replace the dev.domain?.org with your domain names as well as the titles with something that means something to you!)
baci:~/mephisto mikel$ ./script/console Loading development environment (Rails 2.0.1) >> s = Site.create(:host => "dev.domain1.org", ?> :title => "The First Domain Title") # (lots of response code) >> s = Site.create(:host => "dev.domain2.org", ?> :title => "The Second Domain Title") # (lots of response code) >> s = Site.create(:host => "dev.domain3.org", ?> :title => "The Third Domain Title") # (lots of response code)
Note one thing here, you need to use “drugfacts.org.au” for www.drugfacts.org.au. Mephisto will drop any leading www. It won’t drop anything else that is leading, like “dev” or something similar, this is important to remember for when we are deploying into a production environment. However, for us right now, everything is prefixed with “dev” so we use the full name.
Now you should be good to go.
- Rails Security Alert
- Encrypting Another Partition Using FileVault 2 on OSX Lion
- Installing Home Folder on Second Drive on OSX Lion
- undefined local variable or method `version_requirements'
- A New World of Resources
- Rails Static Pages
- Twitter Replacing Rails? So?
- Engine Yard Cloud Backups Generating Zero Length Backups
- Our Rails Rumble Entry - StillAlive.com
- Renaming a controller and redirection in Rails 3
- Updating RailsPlugins.org to Rails 3 - Part 1
- A new protocol for social interaction
- What is a distributed social network?
- Bundler and Public Git Sources
- Getting Heroku, memcached and Rails 3 working
- Why Bundler?
- Rails Commit Access
- Introducing TellThemWhen
- rake RSpec & Cucumber uninitialized constant Rails::Boot::Bundler
- This Relationship is Worth Nothing
- Thank YOU...
- Inline Attachments for ActionMailer
- Upgrading RailsPlugins.org to Rails 3 - Part 1
- Stripping dollar signs and commas from a string
- Getting Rails 3 Edge with jQuery, RSpec and Cucumber using RVM
- Action Mailer, go Proc thyself
- The Real News Donation Drive
- ActionMailer ScreenCast and Article
- Installing RSpec for Rails 3
- I am speaking at RailsConf 2010
- Rails 3 Session Secret and Session Store
- If you're lazy and you know it write your specs!
- Bundler - uninitialized constant ActionController
- Bundle Me Some Sanity
- How to use Mail / ActionMailer 3 with GMail SMTP
- Put your mailer where the action is!
- Why Force a Choice?
- How to make an RSS feed in Rails
- Rails 3 Routing with Rack
- Bundle me some Rails
- Helping out in Haiti
- Watch your self
- Is Rails 3.0 a Game Changer?
- Where did the scripts go?
- validates :rails_3, :awesome => true
- New Rails Version 3.0 Guides Online
- New ActionMailer API in Rails 3.0
- Mail gem version 2 released
- How to rename a Rails 3 Application
- Rails 3.0 Examples
- November 2009 (1)
- October 2009 (2)
- September 2009 (2)
- August 2009 (0)
- July 2009 (1)
- June 2009 (0)
- May 2009 (1)
- April 2009 (0)
- March 2009 (0)
- February 2009 (0)
- January 2009 (2)
- December 2008 (0)
- November 2008 (5)
- October 2008 (0)
- September 2008 (1)
- August 2008 (0)
- July 2008 (2)
- June 2008 (13)
- May 2008 (7)
- April 2008 (18)
- March 2008 (8)
- February 2008 (5)
- January 2008 (7)
- December 2007 (20)
- November 2007 (22)