ankane / rollup

Rollup time-series data in Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect to different database?

bobdutch opened this issue · comments

I'm using a Rails app with multiple databases. The Rollup class in the gem inherits from ActiveRecord::Base so it uses the primary database connection. Is there a way I can change the database connection or superclass for the model? If not I think it would be a good feature. Thanks.

Hey @bobdutch, you should be able to create an initializer with:

Rollup.establish_connection(:otherdb)

That's perfect. Thank you!

Could it read from one db but write on another? Thinking replica for reads primary for writes

Hey @dudadornelles, please create a new issue for this.