We have a Rails app hosted on Heroku and i need to set up some analytics pages for our marketing guy. This seems to be the typical use case for a Heroku follow database
The 2 databases will share the same model classes, i want only some action to query the replicated database.
What is the preferred way to handle this situation in my app ?
ActiveRecord::Base documentation talks about class specific connection :
You can also set a class-specific connection. For example, if Course is an ActiveRecord::Base, but resides in a different database, you can just say Course.establish_connection and Course and all of its subclasses will use this connection instead.
Should i subclass all my model classes to specify connection to a secondary database ? (will it even work ?)
I also found this gem but it seems not maintained anymore.... magic_multi_connections gem ?