Forum: Ruby on Rails Multiple sites sharing a single application

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
882cc23c77c5c6d27613c51396a02a0d?d=identicon&s=25 Stephen Bartholomew (Guest)
on 2006-04-22 19:35
(Received via mailing list)
Quick question:

Say i have a few shopping sites that i want to run on the same
application code but have seperate databases and layout/design, what
would be the neatest 'Rails' way of doing this?

Cheers,

Steve
B84d42a3a5c343f8fc6ab7d7f47fd3f5?d=identicon&s=25 Robby Russell (Guest)
on 2006-04-22 19:42
(Received via mailing list)
Stephen Bartholomew wrote:
> Quick question:
>
> Say i have a few shopping sites that i want to run on the same
> application code but have seperate databases and layout/design, what
> would be the neatest 'Rails' way of doing this?
>

The *Rails* way would be to not have different databases... but access
specific data within scope. The reason behind this is that its much
easier to maintain one database schema than multiple ones and trying to
keep those in sync with each other... especially if one instance of the
application is doing all the heavy lifting.

-Robby
Fb23bc8cd4030c526b0689276b34c8bd?d=identicon&s=25 Bryan Duxbury (bryanduxbury)
on 2006-04-23 03:24
Stephen Bartholomew wrote:
> Quick question:
>
> Say i have a few shopping sites that i want to run on the same
> application code but have seperate databases and layout/design, what
> would be the neatest 'Rails' way of doing this?
>
> Cheers,
>
> Steve

Sounds a little like a job for SVN branches. You could keep your models
in the trunk and branch the controllers and views, or at least just the
views. This would be a quick and dirty way to implement a quick "themes"
system for your application.

As far as running entirely separate instances of the application, I
would suggest using several databases. If they're not truly the "same"
application, then keeping all that data together and adding some sort of
scope is just going to complicate things. Other than their base
software, these different sites are really separate, so make it easy on
yourself and deploy it that way.
882cc23c77c5c6d27613c51396a02a0d?d=identicon&s=25 Stephen Bartholomew (Guest)
on 2006-04-23 12:13
(Received via mailing list)
I think that makes more sense.  This would allow for the sites to
'split' from the common application if one site needed to add additional
bespoke componants.  The main reason for maintaining the core codebase
was for code management - i just wouldn't want to have to bug fix across
3 different places.

Cheers,

Steve
D893e113b51a8f200d2abb3ed9e54143?d=identicon&s=25 Gazoduc (Guest)
on 2006-04-23 21:08
Bryan Duxbury wrote:
> Stephen Bartholomew wrote:
>> Quick question:
>>
>> Say i have a few shopping sites that i want to run on the same
>> application code but have seperate databases and layout/design, what
>> would be the neatest 'Rails' way of doing this?
>>
>> Cheers,
>>
>> Steve
>
> Sounds a little like a job for SVN branches. You could keep your models
> in the trunk and branch the controllers and views, or at least just the
> views. This would be a quick and dirty way to implement a quick "themes"
> system for your application.
>
There is also the svn:externals
(http://svnbook.red-bean.com/en/1.0/ch07s03.html) solution :
A. create an application framework without the modified parts (probably
CSS, config and views)
B. checkout this app for each site
C. set an svn:external on each of these directories to point to the code
for each specific site. Example:
# svn propset svn:externals 'app/views' "svn://example.com/site1/views"
"views"
D. svn up will update code in both app and site specific code. svn
status will tell you to do svn ci into 'views' if needed.
This topic is locked and can not be replied to.