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

Already on GitHub? Sign in to your account

shard not working in a block #51

Closed
mike-ball opened this Issue Sep 19, 2011 · 1 comment

Comments

Projects
None yet
2 participants

I am unable to get Octopus to work inside of a block.
When I do this it does not use the shard, it just uses the default db in database.yml.
Octopus.using(:slave_two) do
User.create(:name => "Mike")
end

The same thing happens when I use the around_filter inside the Controller. It doesn't use the shard I specify at all.

The only way I'm able to specify the shard db is by using this syntax:
User.using(:shard1).find_by_name("Joao")

Do you guys know of anything that would cause this? It would simplify my code a lot of I could use the other block methods.

My shards.yml file looks like this example:
octopus:
environments:
- development
- production
development:
shard_one:
host: localhost
adapter: mysql
database: app_development
production:
shard_one:
host: localhost
adapter: mysql
database: app_production

Collaborator

gaffneyc commented Mar 14, 2012

Based on the example you need to make sure you're using the same names that are defined in the shard.yml file (shard_one and shard_two vs slave_two and shard1) .

@gaffneyc gaffneyc closed this Mar 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment