Skip to content

Instantly share code, notes, and snippets.

@daichirata
Created October 31, 2017 06:47
Show Gist options
  • Save daichirata/f51fc08cc2aced9600054f065040eeb5 to your computer and use it in GitHub Desktop.
Save daichirata/f51fc08cc2aced9600054f065040eeb5 to your computer and use it in GitHub Desktop.
turntable ext
# config/initializers/turntable_ext.rb
module TurntableExt
def target_shard?(shard_name)
(shard_name.nil? && target_shards.blank?) || Array.wrap(target_shards).include?(shard_name)
end
end
ActiveRecord::Migration.prepend(TurntableExt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment