Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using octopus with plain ruby - establish_connection #209

Closed
thaddeusgeek opened this issue Nov 22, 2013 · 1 comment
Closed

using octopus with plain ruby - establish_connection #209

thaddeusgeek opened this issue Nov 22, 2013 · 1 comment

Comments

@thaddeusgeek
Copy link

this could work:

require 'active_record'
require 'ar-octopus'
@db = {'host'=>''...............}
ActiveRecord::Base.establish_connection($db)
class User < ActiveRecord::Base
end

User.take

how to make this work?

require 'active_record'
require 'ar-octopus'
@db = {'host'=>''...............}

class User < ActiveRecord::Base
    establish_connection($db)
end

User.take

the problem is located at proxy.rb line 15

@shards[:master] = ActiveRecord::Base.connection_pool()

by watching connection_pool.rb line 579
octopus is looking for "ActiveRecord::Base" in @class_to_pool

does this mean one project can only have one master connection config?
what if i need 2 masters : a_master, b_master
and 4 slaves: a_slave_1, a_slave_2, b_slave_1, b_slave2

@thiagopradi
Copy link
Owner

Hi @seoaqua ,

Yes, the project can have only one master. All other databases should be specified as shards in the shards.yml file.

I'm closing this issue. If you have any additional problems, please feel free to reopen.

Thiago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants