mobility 0.3.3 → 0.3.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
  SHA1:
3
- metadata.gz: 00e8866b69b091c9fd411212b4f262382dc00da3
4
- data.tar.gz: 45f61733fe33af52d7b4be9e35d75aa0344b6c54
3
+ metadata.gz: e7e38eaafcd681f7aa78b56427f07460f7b995ce
4
+ data.tar.gz: 62b77800ad18af59905506a5a65fc30285a14299
5
5
  SHA512:
6
- metadata.gz: a942928eba9620bdfccede2153501fa994c475d5174b1e7fdab2c76c2acaaf9a1787ec92938c46103afbb156aba5c70c729130311cbceed6903efd00a782c031
7
- data.tar.gz: d455f2eb6fd95cf6a6a4a8a02293917a450be4a272bef424dd292d57bfab466caea1adce71ba3f64fb20770cbbb8dd681f8809b4f4112c111c40f2fd9fd38f88
6
+ metadata.gz: 473fbcc6e40aab4c828478959896d90e8403a96eca495c0df31bb8d9b2faa0e2e49fe3ecd8913035c38c3a69004284f17be963e1cb3aae1744a0f3191df69479
7
+ data.tar.gz: 31545c9e848c7c60ee7ef638063ed66999cded527ba115f943e7acbf84c72ae1944094a3e10a871131ee4ff35a52baf2640d5b1c22d01fc7daad5c5c8cd42e5d
@@ -1,3 +1 @@
1
- <Qw1&�l{�Ȣ���<̦X̭��ɘ=��!�N���*
2
- �ѥjj��Dc�F����-ހAGɆր}I��I�ab��u~�>��@�i�����ü(��}E_��Q0�bɫ"�V�+�蘡�ͥ`~f�[P���
3
- ���D7>�P{��M�b��L�������!Ck����)[
1
+ ~|O�;������5��n���NB�-�=R0���=��v��f8����(O�˥��B�#Q��]�|�tR��~,N�,�4�������g,�ȕcv
data.tar.gz.sig CHANGED
Binary file
@@ -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))
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility (0.3.2)
4
+ mobility (0.3.3)
5
5
  i18n (>= 0.6.10, < 0.10)
6
6
  request_store (~> 1.0)
7
7
 
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.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 [API documentation for
677
- AR query
678
- methods](http://www.rubydoc.info/gems/mobility/Mobility/Backend/ActiveRecord/KeyValue/QueryMethods).
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.inject(nil) { |ops, attr|
16
- column = m[attr.to_sym]
17
- value = opts.delete(attr)
15
+ i18n_query = i18n_keys.map { |key|
16
+ column = m[key.to_sym]
17
+ value = opts.delete(key)
18
18
 
19
- op =
20
- if value.nil?
21
- infix.new(:'?', column, locale).not
22
- else
23
- infix.new(:'->', m[attr.to_sym], locale).eq(value)
24
- end
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.inject(nil) { |ops, attr|
48
- column = m[attr.to_sym]
49
- value = Arel::Nodes.build_quoted(opts.delete(attr).to_s)
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
- op = has_key.and(not_eq_value)
53
- ops ? ops.and(op) : op
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.inject(nil) { |ops, attr|
18
- column = m[attr.to_sym]
19
- value = opts.delete(attr)
17
+ i18n_query = i18n_keys.map { |key|
18
+ column = m[key.to_sym]
19
+ value = opts.delete(key)
20
20
 
21
- op =
22
- if value.nil?
23
- infix.new(:'?', column, locale).not
24
- else
25
- predicate = Arel::Nodes.build_quoted({ Mobility.locale => value }.to_json)
26
- infix.new(:'@>', m[attr.to_sym], predicate)
27
- end
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.inject(nil) { |ops, attr|
51
- column = m[attr.to_sym]
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(attr) }.to_json)
54
- not_eq_value = infix.new(:'@>', m[attr.to_sym], predicate).not
55
- op = has_key.and(not_eq_value)
56
- ops ? ops.and(op) : op
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
@@ -25,7 +25,6 @@ instance. See {Mobility::Plugins::AttributeMethods} for further details.
25
25
  attributes.merge(name.to_s => send(name))
26
26
  end)
27
27
  end
28
- delegate :translated_attribute_names, to: :class
29
28
  end
30
29
 
31
30
  def included(model_class)
@@ -1,3 +1,3 @@
1
1
  module Mobility
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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.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-05 00:00:00.000000000 Z
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