elasticsearch-model-mongoid_extensions 1.1.0 → 1.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51c2855c08e68e44f7630c57fe03f00cdce0bd4b78de67989436b494f40acc40
|
4
|
+
data.tar.gz: 1f72120ee7612d3d873278b6d6cf431232d9db1c5dcc2056bea82c56b39d9ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa7d34e369a02fc8922bf4742a7e0bf1248ea388ce7d9d7a0b38ba8428284c8433051528d6ba227ac3c92d0d636fed09e48818f341515eed4b435934ce0baad0
|
7
|
+
data.tar.gz: bc83083b9d66f8f1c2ed3fbab8f08f030423f673777ef5c3797108f686045ce59492992a84d735a68a24aa164938da86a0805990a6b2b7f188f8623c47544e93
|
data/CHANGELOG.md
CHANGED
@@ -31,9 +31,22 @@ module Elasticsearch
|
|
31
31
|
fields.select { |_, field| field.localized? }.each do |name, field|
|
32
32
|
aliased_name = field.options[:as].to_s
|
33
33
|
translations_field_name = [name, 'translations'].join('_')
|
34
|
-
|
35
|
-
|
34
|
+
field_obj = send(translations_field_name)
|
35
|
+
field_key = aliased_name.presence || name
|
36
|
+
|
37
|
+
obj[field_key] = I18n.available_locales.each_with_object({}) do |locale, res|
|
38
|
+
res[locale.to_s] = field_obj[locale.to_s].presence || field_obj[locale]
|
39
|
+
|
40
|
+
next if res[locale].present?
|
41
|
+
|
42
|
+
if field.send(:fallbacks?) && ::I18n.respond_to?(:fallbacks)
|
43
|
+
next unless fallbacks_for_locale = ::I18n.fallbacks[locale]
|
44
|
+
next unless fallback_locale = fallbacks_for_locale.map(&:to_s).find{ |loc| field_obj.has_key?(loc) && field_obj[loc].present? }
|
45
|
+
res[locale.to_s] = field_obj[fallback_locale]
|
46
|
+
end
|
36
47
|
end
|
48
|
+
|
49
|
+
obj
|
37
50
|
end
|
38
51
|
end
|
39
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-model-mongoid_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|