3 ms·
Rails _did_ support multiple databases up until then, it just wasn't _as easy_ as everything else in rails. You just defined another database in database.yml (s
by loktarogar 6y ago
Rails _did_ support multiple databases up until then, it just wasn't _as easy_ as everything else in rails. You just defined another database in database.yml (say "second_database") and then ran something like
class Foo < ActiveRecord::Base
establish_connection :second_database
end
Still pretty straight forward and simple - just opaque.
A lot was available in the Rails ecosystem or using Rails code without being explicitly supported by Rails itself. Much of the last few years has been including support for stuff like this that was already being used. To me, that's what a mature framework does.
- viraptor 6y agoThat's just per-model database annotation. It's not enough for use cases like: data sharding, switching reader/writer endpoints at runtime, and a few others. I wouldn't count the basic case as "multi-db support"
- mathnmusic 6y agoI built a Rails app with exactly that set up: sharding, dynamic switching of read/write queries across multiple slaves 10 years ago. It wasn't hard at all. Ruby's full dynamic nature makes many things easy.
- viraptor 6y agoYes, I mentioned it too https://news.ycombinator.com/item?id=24937220 https://news.ycombinator.com/item?id=24937220 - it's relatively easy to add this if needed. But I would not describe it as supported natively.