active_record_shards 2.7.2 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,15 +34,16 @@ module ActiveRecordShards
34
34
  module InstanceMethods
35
35
  def after_initialize_with_slave
36
36
  after_initialize_without_slave if respond_to?(:after_initialize_without_slave)
37
- @shard_selection = self.class.current_shard_selection.options.clone
37
+ @from_slave = !!self.class.current_shard_selection.options[:slave]
38
+ @from_shard = self.class.current_shard_selection.options[:shard]
38
39
  end
39
40
 
40
41
  def from_slave?
41
- @shard_selection[:slave]
42
+ @from_slave
42
43
  end
43
44
 
44
45
  def from_shard
45
- @shard_selection[:shard]
46
+ @from_shard
46
47
  end
47
48
  end
48
49
 
@@ -145,6 +145,12 @@ class ConnectionSwitchingTest < ActiveSupport::TestCase
145
145
  should "get colmns from the first shard" do
146
146
  assert Ticket.column_names.include?('foo')
147
147
  end
148
+
149
+ should "have correct from_shard" do
150
+ ActiveRecord::Base.on_all_shards do |shard|
151
+ assert_equal shard, Ticket.new.from_shard
152
+ end
153
+ end
148
154
  end
149
155
  end
150
156
 
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: 2.7.2
4
+ version: 2.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-03-14 00:00:00.000000000 Z
14
+ date: 2013-06-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activerecord
@@ -68,7 +68,7 @@ files:
68
68
  - test/migrator_test.rb
69
69
  - test/models.rb
70
70
  - test/schema.rb
71
- homepage: http://github.com/staugaard/active_record_shards
71
+ homepage: http://github.com/zendesk/active_record_shards
72
72
  licenses:
73
73
  - MIT
74
74
  post_install_message:
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 1.8.24
92
+ rubygems_version: 1.8.21
93
93
  signing_key:
94
94
  specification_version: 3
95
95
  summary: Simple database switching for ActiveRecord.