mobility 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/lib/mobility/active_record.rb +1 -0
- data/lib/mobility/backends/active_record/hstore/query_methods.rb +14 -17
- data/lib/mobility/backends/active_record/jsonb/query_methods.rb +16 -19
- data/lib/mobility/plugins/active_record/attribute_methods.rb +0 -1
- data/lib/mobility/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e38eaafcd681f7aa78b56427f07460f7b995ce
|
4
|
+
data.tar.gz: 62b77800ad18af59905506a5a65fc30285a14299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 473fbcc6e40aab4c828478959896d90e8403a96eca495c0df31bb8d9b2faa0e2e49fe3ecd8913035c38c3a69004284f17be963e1cb3aae1744a0f3191df69479
|
7
|
+
data.tar.gz: 31545c9e848c7c60ee7ef638063ed66999cded527ba115f943e7acbf84c72ae1944094a3e10a871131ee4ff35a52baf2640d5b1c22d01fc7daad5c5c8cd42e5d
|
checksums.yaml.gz.sig
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## 0.3
|
4
4
|
|
5
|
+
### 0.3.4 (December 6, 2017)
|
6
|
+
* Move `translated_attribute_names` to `Mobility::ActiveRecord`
|
7
|
+
([#132](https://github.com/shioyama/mobility/pull/129))
|
8
|
+
* Refactor AR pg query methods ([#129](https://github.com/shioyama/mobility/pull/129))
|
9
|
+
|
5
10
|
### 0.3.3 (December 5, 2017)
|
6
11
|
* Fix duping for AR KeyValue backend ([#126](https://github.com/shioyama/mobility/pull/126))
|
7
12
|
* Pass locale and options to Proc in default plugin ([#122](https://github.com/shioyama/mobility/pull/122))
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -54,7 +54,7 @@ Installation
|
|
54
54
|
Add this line to your application's Gemfile:
|
55
55
|
|
56
56
|
```ruby
|
57
|
-
gem 'mobility', '~> 0.3.
|
57
|
+
gem 'mobility', '~> 0.3.4'
|
58
58
|
```
|
59
59
|
|
60
60
|
Mobility is cryptographically signed. To be sure the gem you install hasn't
|
@@ -673,9 +673,9 @@ WHERE "content_mobility_text_translations"."value" = 'bar'
|
|
673
673
|
As can be seen in the query above, behind the scenes Mobility joins two tables,
|
674
674
|
one with string translations and one with text translations, and aliases the
|
675
675
|
joins for each attribute so as to match the particular values passed in to the
|
676
|
-
query. Details of how this is done can be found in the [
|
677
|
-
|
678
|
-
|
676
|
+
query. Details of how this is done can be found in the [Wiki page for the
|
677
|
+
KeyValue
|
678
|
+
backend](https://github.com/shioyama/mobility/wiki/KeyValue-Backend#querying).
|
679
679
|
|
680
680
|
If you would prefer to avoid the `i18n` scope everywhere, define it as a
|
681
681
|
default scope on your model:
|
@@ -16,6 +16,7 @@ Module loading ActiveRecord-specific classes for Mobility models.
|
|
16
16
|
model_class.extend query_method
|
17
17
|
model_class.const_set(:UniquenessValidator,
|
18
18
|
Class.new(::Mobility::ActiveRecord::UniquenessValidator))
|
19
|
+
model_class.delegate :translated_attribute_names, to: :class
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -12,18 +12,16 @@ module Mobility
|
|
12
12
|
opts = opts.with_indifferent_access
|
13
13
|
infix = Arel::Nodes::InfixOperation
|
14
14
|
|
15
|
-
i18n_query = i18n_keys.
|
16
|
-
column = m[
|
17
|
-
value = opts.delete(
|
15
|
+
i18n_query = i18n_keys.map { |key|
|
16
|
+
column = m[key.to_sym]
|
17
|
+
value = opts.delete(key)
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
ops ? ops.and(op) : op
|
26
|
-
}
|
19
|
+
if value.nil?
|
20
|
+
infix.new(:'?', column, locale).not
|
21
|
+
else
|
22
|
+
infix.new(:'->', m[key.to_sym], locale).eq(value)
|
23
|
+
end
|
24
|
+
}.inject(&:and)
|
27
25
|
|
28
26
|
opts.empty? ? super(i18n_query) : super(opts, *rest).where(i18n_query)
|
29
27
|
else
|
@@ -44,14 +42,13 @@ module Mobility
|
|
44
42
|
opts = opts.with_indifferent_access
|
45
43
|
infix = Arel::Nodes::InfixOperation
|
46
44
|
|
47
|
-
i18n_query = i18n_keys.
|
48
|
-
column = m[
|
49
|
-
value = Arel::Nodes.build_quoted(opts.delete(
|
45
|
+
i18n_query = i18n_keys.map { |key|
|
46
|
+
column = m[key.to_sym]
|
47
|
+
value = Arel::Nodes.build_quoted(opts.delete(key).to_s)
|
50
48
|
has_key = infix.new(:'?', column, locale)
|
51
49
|
not_eq_value = infix.new(:'->', column, locale).not_eq(value)
|
52
|
-
|
53
|
-
|
54
|
-
}
|
50
|
+
has_key.and(not_eq_value)
|
51
|
+
}.inject(&:and)
|
55
52
|
|
56
53
|
super(opts, *rest).where(i18n_query)
|
57
54
|
else
|
@@ -14,19 +14,17 @@ module Mobility
|
|
14
14
|
opts = opts.with_indifferent_access
|
15
15
|
infix = Arel::Nodes::InfixOperation
|
16
16
|
|
17
|
-
i18n_query = i18n_keys.
|
18
|
-
column = m[
|
19
|
-
value = opts.delete(
|
17
|
+
i18n_query = i18n_keys.map { |key|
|
18
|
+
column = m[key.to_sym]
|
19
|
+
value = opts.delete(key)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
ops ? ops.and(op) : op
|
29
|
-
}
|
21
|
+
if value.nil?
|
22
|
+
infix.new(:'?', column, locale).not
|
23
|
+
else
|
24
|
+
predicate = Arel::Nodes.build_quoted({ Mobility.locale => value }.to_json)
|
25
|
+
infix.new(:'@>', m[key.to_sym], predicate)
|
26
|
+
end
|
27
|
+
}.inject(&:and)
|
30
28
|
|
31
29
|
opts.empty? ? super(i18n_query) : super(opts, *rest).where(i18n_query)
|
32
30
|
else
|
@@ -47,14 +45,13 @@ module Mobility
|
|
47
45
|
opts = opts.with_indifferent_access
|
48
46
|
infix = Arel::Nodes::InfixOperation
|
49
47
|
|
50
|
-
i18n_query = i18n_keys.
|
51
|
-
column = m[
|
48
|
+
i18n_query = i18n_keys.map { |key|
|
49
|
+
column = m[key.to_sym]
|
52
50
|
has_key = infix.new(:'?', column, locale)
|
53
|
-
predicate = Arel::Nodes.build_quoted({ Mobility.locale => opts.delete(
|
54
|
-
not_eq_value = infix.new(:'@>', m[
|
55
|
-
|
56
|
-
|
57
|
-
}
|
51
|
+
predicate = Arel::Nodes.build_quoted({ Mobility.locale => opts.delete(key) }.to_json)
|
52
|
+
not_eq_value = infix.new(:'@>', m[key.to_sym], predicate).not
|
53
|
+
has_key.and(not_eq_value)
|
54
|
+
}.inject(&:and)
|
58
55
|
|
59
56
|
super(opts, *rest).where(i18n_query)
|
60
57
|
else
|
data/lib/mobility/version.rb
CHANGED
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: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
eGDROPZoL5RXwiOnRbexxa7dcAxMrDfGB/hpiunIPWPsi4n5P7K/6OO/sGVMl9xv
|
31
31
|
SZBPXjzrHdyOFLBYXB+PG7s3F/4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2017-12-
|
33
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: request_store
|
metadata.gz.sig
CHANGED
Binary file
|