Hi there, I am dealing with a legacy database.
We have 3 separate MySQL databases with identicle structure.
We have one Rails Instance.
based on the url:
i need to use database one, two, or three respectivly.
All the app files are identicle the only reason the databases are split
is because the CMS had no way to separate the content between sites so
they just used different databases. The database scema are rails
friendly so i am using AR associations.
My thought was to have a parent class (DbSwitch) that took an
initialization parameter(site) and picked a db_config but I don’t think
that will work for the find statments as i will have to pass an
initialization param in the find. Item.new(“one”) is fine but how do
i add the “one” to the item.find(:all) ?
My other thought was to set an environment var per-user depending on the
url and then just leave the app alone. Is that possible?
Any sugestions would be greatly appriciated…