Mutliple sites on single code base architecture

Hi there,

I’m going to be building out several sites with almost identical
functionality, driven by a single cms. I have an idea about what I want
to do, but i’m a little confused about what the architecture should be.

I know i’ll need one app for the cms which will control all the sites,
so:
rails/cms

but, when I want to have many sites running of the same code base,
should I have

option1

rails/site1
rails/site2
rails/site3

etc, etc

or
option 2
rails/megasite

I feel like the first option might be better, but when I expand to 10 or
20 sites, doesn’t that mean I’d have to push the codebase for each one?

in option 2 I’d have to do set some global params based on the url they
come in on to let the app know which site to serve.

is there some sort of halfway solution? has anyone done anything like
this before on rails? any insight would be appreciated!

thanks!