Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

shard not working in a block #51

Closed
mike-ball opened this Issue · 1 comment

2 participants

@mike-ball

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

@gaffneyc
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.