tsukasaoishi / fresh_connection

FreshConnection provides access to one or more configured database replicas.
MIT License
58 stars 11 forks source link

undefined method `master_db_only!` when applying workaround from https://github.com/tsukasaoishi/fresh_connection/issues/12 #31

Closed mr-sudaca closed 5 years ago

mr-sudaca commented 5 years ago

Hi @tsukasaoishi, I followed the suggestion you proposed on https://github.com/tsukasaoishi/fresh_connection/issues/12 but now I have this error

/Users/jhon/.rvm/gems/ruby-2.3.1@ploos/gems/activerecord-4.2.10/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `master_db_only!'

I'm using master_db_only! in 3 models right now. Is there a workaround for this?

mr-sudaca commented 5 years ago

Hi @tsukasaoishi again, I just tried your workaround but moving new_relic gem to the after_initialize block and now it's working correctly. Closing

mr-sudaca commented 5 years ago

new relic is not getting initialized by doing this. Reopening

mr-sudaca commented 5 years ago

Adding require 'fresh_connection' to the models fixed the issue. Closing (again) (and sorry for the back and forth with this)