Ruby on Rails Friday, March 2, 2018

I was wondering if there is a way how to do Rails Engines (as bound contexts) where each engine would have it's own (ActiveRecord) database. 

Referring to article https://medium.com/@dan_manges/the-modular-monolith-rails-architecture-fb1023826fc4

Imagine every bound context (Rails engine) would have own DB (like microservices has) 

Online store app
  * product listing - own postgres DB
  * orders  - own postgres DB
  * basket - own postgres DB


I know that this could teoretically be done on model level:

module YourEngine    class Post < ActiveRecord::Base      establish_connection :adapter => 'sqlite3', :database => 'db/your_engine.sqlite3'    end  end


But is there anything like `my_engine/config/database.yml`  ==> own ActiveRecord database setup for every engine ? 

I'm purely just investigating the possibilities for a talk don't really want to implement something like that

Thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2a44beab-382d-4c96-bb67-f889d44012d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment