mobility-actiontext 0.6.0 → 1.0.0
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
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/mobility/action_text/version.rb +1 -1
- data/lib/mobility/backends/action_text.rb +6 -0
- data/test_app/Gemfile.lock +1 -1
- data/test_app/test/mobility_action_text_test.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07d1047f391d3c0dde02a646adc682b3a09f1e99a2e4beb04c7ba3b971a41e0d
|
4
|
+
data.tar.gz: a49bf73b5b911d02a71eacc5f84f9f18ed91865befb9b2872a29025bb7be6813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56786adb17b842818b65b6de35403a987c8b49dc570c4a00a367995160590c58f284374e74c391bc6aee37d05b2c1cf081aee878ce83232d877daeba86292ed6
|
7
|
+
data.tar.gz: e82e781d93cd99fce6bb5e85fff45334b39cedc50a6772476a4fa22ed1319f0beabf9c20df1b319fe514f6e70743dff9880dcdac5814bbfc2c460bb32886843a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Mobility Action Text Changelog
|
2
2
|
|
3
|
+
### 1.0.0 (2022-02-28)
|
4
|
+
- Fix eager loading of single translation using `with_rich_text_#{name}` ([#24](https://github.com/sedubois/mobility-actiontext/pull/24)).
|
5
|
+
|
6
|
+
The version update to 1.0.0 indicates the plugin has no more known issues.
|
7
|
+
|
3
8
|
### 0.6.0 (2022-02-27)
|
4
9
|
- Include all translations on eager load using `with_all_rich_text` ([#23](https://github.com/sedubois/mobility-actiontext/pull/23)).
|
5
10
|
|
data/Gemfile.lock
CHANGED
@@ -28,6 +28,12 @@ module Mobility
|
|
28
28
|
# override to return record instead of value
|
29
29
|
def read(locale, **options)
|
30
30
|
return super if self.options[:plain]
|
31
|
+
|
32
|
+
if model.association_cached?("rich_text_#{attribute}")
|
33
|
+
eager_loaded = model.public_send("rich_text_#{attribute}")
|
34
|
+
return eager_loaded if eager_loaded.locale == locale.to_s
|
35
|
+
end
|
36
|
+
|
31
37
|
translation_for(locale, **options)
|
32
38
|
end
|
33
39
|
|
data/test_app/Gemfile.lock
CHANGED
@@ -100,11 +100,15 @@ module Mobility
|
|
100
100
|
|
101
101
|
assert_no_queries do
|
102
102
|
assert_equal 'Hello world!', post.content.to_plain_text
|
103
|
-
|
104
|
-
skip('FIXME: this should execute no queries')
|
105
103
|
end
|
106
104
|
end
|
107
105
|
|
106
|
+
test 'correct translation is returned if single translation for different locale was eager loaded' do
|
107
|
+
post = assert_queries(2) { Mobility.with_locale(:en) { Post.with_rich_text_content.last } }
|
108
|
+
|
109
|
+
assert_equal 'Bonjour le monde !', Mobility.with_locale(:fr) { post.content }.to_plain_text
|
110
|
+
end
|
111
|
+
|
108
112
|
test 'post content is eager loaded with all rich text' do
|
109
113
|
post = assert_queries(2) { Post.with_all_rich_text.last }
|
110
114
|
|
@@ -113,6 +117,12 @@ module Mobility
|
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
120
|
+
test 'correct translation is returned if all translations for different locale were eager loaded' do
|
121
|
+
post = assert_queries(2) { Mobility.with_locale(:en) { Post.with_all_rich_text.last } }
|
122
|
+
|
123
|
+
assert_equal 'Bonjour le monde !', Mobility.with_locale(:fr) { post.content }.to_plain_text
|
124
|
+
end
|
125
|
+
|
116
126
|
test 'post non_i18n_content is eager loaded with all rich text' do
|
117
127
|
post = assert_queries(2) { Post.with_all_rich_text.last }
|
118
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobility-actiontext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Dubois
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actiontext
|