I'm trying to set up sharding between different customer databases so this
is the code:
def initialize(app)
@app = app
servers =
YAML.load_file(File.open('config/database.yml'))(environment).symbolize_keys!
@sequel = Sequel.connect(servers[:db_dev], servers: servers, logger:
Logger.new("log/#{environment}_db.log"))
@sequel.extension :server_block
end
def call(env)
customer = find_customer(key).to_sym
puts "customer: #{customer}"
@sequel.with_server(customer) do
env['customer'] = customer
env['db-connection'] = @sequel
@app.call(env)
end
Hardcoding a customer name into the with_server block also returns the
default server db_dev. Am I missing something here?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.