active_record_shards 4.0.0.beta5 → 4.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 635a833192fb641e710ff4bf7b30380023936a1a
4
- data.tar.gz: 8fa608a3b2f2f692b20b8445a4a21d879b88688f
3
+ metadata.gz: 4a5e26f845c2b9628ad246c6afafc466be8d00c8
4
+ data.tar.gz: ccffb2df58a242e590c6f5940a30814572eaf742
5
5
  SHA512:
6
- metadata.gz: 2ea40014c08f3670c4155e721d05abcab31eb366b6761a02fb1386710288d9f9ca59ea8f2580da0d71d4f502ede737775952f3f0a47140f7527e6a2eabf49716
7
- data.tar.gz: 6343baabe62a1a3007a8cacd42eea95873e0a7f5713249e8d65c1b0ba16f6b0850eaf5429b06fa5ba7dc7f4e6641d38342fe3a30a57a4b00bd1f67cc0951ad8e
6
+ metadata.gz: 96333291c802edcfd68cf8bb989252bfed8b08e72c8afca8bf8d09098b7053b18ec58472df76f1cf48cc05a624570ab4996e350440d42c0908f5bb5b86c08e56
7
+ data.tar.gz: ac5e5f9820f2d91d8eb726312a60e509e9d000dd72d5f04e19ff7cc6956352ec9aa8643ff244385ba48332dbe44eb5e4dd672d5594dfb25382ebbe304ad2ffdd
@@ -64,6 +64,10 @@ module ActiveRecordShards
64
64
  current_shard_selection.shard
65
65
  end
66
66
 
67
+ def on_shard?
68
+ current_shard_selection.on_shard?
69
+ end
70
+
67
71
  def shard_names
68
72
  unless config = configurations[shard_env]
69
73
  raise "Did not find #{shard_env} in configurations, did you forget to add it to your database config? (configurations: #{configurations.inspect})"
@@ -10,5 +10,9 @@ module ActiveRecordShards
10
10
  def connection_config
11
11
  raise NoShardSelected, "No shard selected, can't connect"
12
12
  end
13
+
14
+ def on_shard?
15
+ false
16
+ end
13
17
  end
14
18
  end
@@ -10,5 +10,9 @@ module ActiveRecordShards
10
10
  def connection_config
11
11
  { shard: shard }
12
12
  end
13
+
14
+ def on_shard?
15
+ true
16
+ end
13
17
  end
14
18
  end
@@ -79,7 +79,7 @@ module ActiveRecordShards
79
79
  end
80
80
 
81
81
  def current_slave_selection
82
- Thread.current[:slave_selection] ||= false
82
+ !!Thread.current[:slave_selection]
83
83
  end
84
84
 
85
85
  def connection_config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_shards
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta5
4
+ version: 4.0.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard