On Monday, May 19, 2014 11:06:43 PM UTC-7, Glen Bray wrote:
>
> 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?
>
Nothing jumps out at me as being wrong here, but there are a lot of unknown
variables (e.g. contents of the servers hash, value of key). Any chance
you can create a self-contained reproducible test case showing the issue?
Thanks,
Jeremy
--
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.