mobility 1.2.6 → 1.2.7

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: 9c7f067617904bfb7739ce49cd155ffc0ec0b6aeeb7ebdbbf13309afd0e7a106
4
- data.tar.gz: ced82292e8e99ee28bb7b3962e964147481200539db25d87bae0caa24fa783da
3
+ metadata.gz: f9ff30d2d033cff7555cc4a4ed4d463d7670df67e4e23302534f35fc6bf34649
4
+ data.tar.gz: d3097e35c0d8e6fc65c88fc038fcb056add50c4a87384ece6e71321c33a71aac
5
5
  SHA512:
6
- metadata.gz: 38494c35209217644cf9b408ce0d55c671b65db3b131118d0ce934b6065eccb0d64a032ede1dba0244cf28a3960973163f0c3ac31976fd8248eb514a750a0a49
7
- data.tar.gz: fe5d5ef7ea05f091eaed43330b9f8e1b23716176daf2595a61fdb01344fc25cfa92a2ba237822e5b9bcec101c60f9d22ab63ae2cd59c888ff4315ac08150d49b
6
+ metadata.gz: 10b8f7d41910f51e21fbf6ad5603e284070c202d224518b788067df6ea4fc77f180b2273498307a8f5d77f88963eee06917bea68f51a41d98308c60bc2091cf5
7
+ data.tar.gz: 20cdcc3adc28dae960ea83a58b1aa2ba92515e824a6ebe35a4bb3d896c9b0eae3aae0b8198c32304dfb9d2eec8a794b427a50f3f4f0c75e0b2e8d307ad40fb69
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## 1.2
4
4
 
5
+ ### 1.2.7
6
+ - Do not query same attribute more than once, fixes
7
+ [#564](https://github.com/shioyama/mobility/pull/578)
8
+ ([#577](https://github.com/shioyama/mobility/pull/577))
9
+
5
10
  ### 1.2.6
6
11
  - Require mfa on rubygems
7
12
  ([#545](https://github.com/shioyama/mobility/pull/545))
data/Gemfile.lock CHANGED
@@ -41,6 +41,7 @@ GEM
41
41
  notiffany (0.1.3)
42
42
  nenv (~> 0.1)
43
43
  shellany (~> 0.0)
44
+ pg (1.3.5)
44
45
  pry (0.13.1)
45
46
  coderay (~> 1.1)
46
47
  method_source (~> 1.0)
@@ -67,6 +68,7 @@ GEM
67
68
  diff-lcs (>= 1.2.0, < 2.0)
68
69
  rspec-support (~> 3.10.0)
69
70
  rspec-support (3.10.2)
71
+ sequel (5.57.0)
70
72
  shellany (0.0.1)
71
73
  thor (1.1.0)
72
74
  yard (0.9.26)
@@ -79,9 +81,11 @@ DEPENDENCIES
79
81
  database_cleaner (~> 1.5, >= 1.5.3)
80
82
  guard-rspec
81
83
  mobility!
84
+ pg
82
85
  pry-byebug
83
86
  rake (~> 12, >= 12.2.1)
84
87
  rspec (~> 3.0)
88
+ sequel (~> 5.0)
85
89
  yard (~> 0.9.0)
86
90
 
87
91
  BUNDLED WITH
data/README.md CHANGED
@@ -55,7 +55,7 @@ Installation
55
55
  Add this line to your application's Gemfile:
56
56
 
57
57
  ```ruby
58
- gem 'mobility', '~> 1.2.6'
58
+ gem 'mobility', '~> 1.2.7'
59
59
  ```
60
60
 
61
61
  ### ActiveRecord (Rails)
@@ -223,10 +223,13 @@ enabled for any one attribute on the model.
223
223
 
224
224
  keys, predicates = opts.keys.map(&:to_s), []
225
225
 
226
+ used_keys = []
227
+
226
228
  query_map = mods.inject(IDENTITY) do |qm, mod|
227
- i18n_keys = mod.names & keys
229
+ i18n_keys = mod.names & keys - used_keys
228
230
  next qm if i18n_keys.empty?
229
231
 
232
+ used_keys += i18n_keys
230
233
  mod_predicates = i18n_keys.map do |key|
231
234
  build_predicate(scope.backend_node(key.to_sym, locale), opts.delete(key))
232
235
  end
@@ -135,10 +135,13 @@ ActiveRecord query plugin.
135
135
  keys, predicates = cond.keys, []
136
136
  model = dataset.model
137
137
 
138
+ used_keys = []
139
+
138
140
  query_map = attribute_modules(model).inject(IDENTITY) do |qm, mod|
139
- i18n_keys = mod.names.map(&:to_sym) & keys
141
+ i18n_keys = mod.names.map(&:to_sym) & keys - used_keys
140
142
  next qm if i18n_keys.empty?
141
143
 
144
+ used_keys += i18n_keys
142
145
  mod_predicates = i18n_keys.map do |key|
143
146
  build_predicate(dataset.backend_op(key, locale), cond.delete(key))
144
147
  end
@@ -8,7 +8,7 @@ module Mobility
8
8
  module VERSION
9
9
  MAJOR = 1
10
10
  MINOR = 2
11
- TINY = 6
11
+ TINY = 7
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
@@ -34,7 +34,7 @@ cert_chain:
34
34
  QHgocnSksU5GOM+G2UhjVycbTamd+bCxjWAZTEDZNafFt5CmnfK1D1UTIblR/ci9
35
35
  fUDdW+GhxhobB8N1mtDRlhELoxLLjx7mSvJ3Wg==
36
36
  -----END CERTIFICATE-----
37
- date: 2022-03-02 00:00:00.000000000 Z
37
+ date: 2022-06-18 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: request_store
metadata.gz.sig CHANGED
Binary file