switchman 2.1.3 → 2.1.4

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
  SHA256:
3
- metadata.gz: 62fa2df72b999208e937ba7df468f122159e573d3e838cf86df601592e64fb0c
4
- data.tar.gz: 20e83c56b8043a8d5e9fbc433db4b1a26a6ec7291389c59463a47ea2ed0b0b87
3
+ metadata.gz: d96c8878af2c919433712e502ab527fd77e811eeb88a652357cc004fb5a40ac7
4
+ data.tar.gz: b8f9e1cb90e7dfbfb25ea02a8699a6c8e20d305f60a13f062a1d71d1da27816e
5
5
  SHA512:
6
- metadata.gz: 7c2cdc6f074ddb755b8a80dad67a2828a8f52d2c034f9ec7bdf473d2e2241cf21b80969cc3f6d0dcc33b6713f299ea976370800640a54839d0895cd41c29f01a
7
- data.tar.gz: 68651c29f71fad57c1e6bbc02b35c6e607a98bc708045841b547c07de4f0ce63048d4a22b22c561d4692a728adc8740fd139ef4d88e5e777cf593e1de679ca9b
6
+ metadata.gz: bb9130947cbff85fef69fdb3f3ac54c29aa9cf7f95507faf92ac97673828addeebe58c9ff1fc478ff34daa834e2f42774a81a99b5bd42dde7e06e3fd63ff6dca
7
+ data.tar.gz: 1e9fd256868e5b35a0f8d34c5726af34bc7381d76f77f9988d623da84b510959a4ff8563956c797c4921961a8540dd1f8fe74882df9027b4946b93e087309284
@@ -80,17 +80,17 @@ module Switchman
80
80
  end
81
81
  end
82
82
 
83
- def self.included(klass)
84
- klass.extend(ClassMethods)
85
- klass.set_callback(:initialize, :before) do
86
- unless @shard
87
- if self.class.sharded_primary_key?
88
- @shard = Shard.shard_for(self[self.class.primary_key], Shard.current(self.class.shard_category))
89
- else
90
- @shard = Shard.current(self.class.shard_category)
91
- end
92
- end
83
+ def self.prepended(klass)
84
+ klass.singleton_class.prepend(ClassMethods)
85
+ end
86
+
87
+ def _run_initialize_callbacks
88
+ @shard ||= if self.class.sharded_primary_key?
89
+ Shard.shard_for(self[self.class.primary_key], Shard.current(self.class.shard_category))
90
+ else
91
+ Shard.current(self.class.shard_category)
93
92
  end
93
+ super
94
94
  end
95
95
 
96
96
  def shard
@@ -95,7 +95,7 @@ module Switchman
95
95
 
96
96
  ::StandardError.include(StandardError)
97
97
 
98
- include ActiveRecord::Base
98
+ prepend ActiveRecord::Base
99
99
  include ActiveRecord::AttributeMethods
100
100
  include ActiveRecord::Persistence
101
101
  singleton_class.prepend ActiveRecord::ModelSchema::ClassMethods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "2.1.3"
4
+ VERSION = "2.1.4"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
8
8
  - James Williams
9
9
  - Jacob Fugal
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
  date: 2021-07-29 00:00:00.000000000 Z
@@ -257,7 +257,7 @@ homepage: http://www.instructure.com/
257
257
  licenses:
258
258
  - MIT
259
259
  metadata: {}
260
- post_install_message:
260
+ post_install_message:
261
261
  rdoc_options: []
262
262
  require_paths:
263
263
  - lib
@@ -272,8 +272,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  - !ruby/object:Gem::Version
273
273
  version: '0'
274
274
  requirements: []
275
- rubygems_version: 3.2.24
276
- signing_key:
275
+ rubygems_version: 3.0.3
276
+ signing_key:
277
277
  specification_version: 4
278
278
  summary: Rails sharding magic
279
279
  test_files: []