mobility-actiontext 0.3.0 → 0.6.0

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: e74323391e6747767158f628cd62cae42f9f7fe2ac56d8722c66e5090c1a7474
4
- data.tar.gz: 3be42ee2b4a5fd804cd1f6331657166b497be0a050c8080835e54cf487cb2980
3
+ metadata.gz: 62723fa69cae996e74c0b33dfe0d5babf7395d6384c3c548fc7e06c33fcec9ce
4
+ data.tar.gz: 28ec6773c56d337a844d6b27bd13aebaea539bc0a1fafad50a9cfe0257243c82
5
5
  SHA512:
6
- metadata.gz: a19bbed71a38f112aeb3cfafaf0b78164536a7f2af0f1c0fc82d9eff96aa011fc529edcd5e3c98c691349ab3db6ab8d9116db040c6f4c58784414075a150417a
7
- data.tar.gz: df4a240edf509bce6f574d6a01af1eaad16b25e32d90b967d1ebe3daa740aaa6e00e263c044dcae68111be01feaa7a19291093c58af382fd45f7f859795e2e7e
6
+ metadata.gz: f2b425c119565f978ed06b45e54bb9c452d648a4ff39026b35dbd50cce2d567f555685de9d56d68b0c02d2559a5f4dbee453e76edf61846321b40972387bf704
7
+ data.tar.gz: 6eced781dcc3440abcb988f898979caca2511eda42486d11a141fa457f26802532d609bbeaa32a8127f036eb563850a3a6035c0a84ec05d6bad1a906c43f4aae
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.0.2
1
+ ruby-3.1.1
data/CHANGELOG.md CHANGED
@@ -1,10 +1,19 @@
1
1
  # Mobility Action Text Changelog
2
2
 
3
+ ### 0.6.0 (2022-02-27)
4
+ - Include all translations on eager load using `with_all_rich_text` ([#23](https://github.com/sedubois/mobility-actiontext/pull/23)).
5
+
6
+ ### 0.5.0 (2022-02-13)
7
+ - Require only actiontext in gemspec dependencies ([#20](https://github.com/sedubois/mobility-actiontext/pull/20)).
8
+
9
+ ### 0.4.0 (2021-12-20)
10
+ - Add Rails 7 compatibility.
11
+
3
12
  ### 0.3.0 (2021-10-07)
4
- - Fix destroying records (#12).
13
+ - Fix destroying records ([#12](https://github.com/sedubois/mobility-actiontext/pull/12)).
5
14
 
6
15
  ### 0.2.0 (2021-04-03)
7
- - Widen Ruby compatibility to >= 2.5.
16
+ - Widen Ruby compatibility to >= 2.5 ([#6](https://github.com/sedubois/mobility-actiontext/pull/6)).
8
17
 
9
18
  ### 0.1.0 (2021-02-26)
10
19
  - Initial release.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,153 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility-actiontext (0.3.0)
4
+ mobility-actiontext (0.6.0)
5
+ actiontext (>= 6.0)
5
6
  mobility (~> 1.2)
6
- rails (~> 6.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.4.1)
12
- actionpack (= 6.1.4.1)
13
- activesupport (= 6.1.4.1)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.4.1)
17
- actionpack (= 6.1.4.1)
18
- activejob (= 6.1.4.1)
19
- activerecord (= 6.1.4.1)
20
- activestorage (= 6.1.4.1)
21
- activesupport (= 6.1.4.1)
22
- mail (>= 2.7.1)
23
- actionmailer (6.1.4.1)
24
- actionpack (= 6.1.4.1)
25
- actionview (= 6.1.4.1)
26
- activejob (= 6.1.4.1)
27
- activesupport (= 6.1.4.1)
28
- mail (~> 2.5, >= 2.5.4)
29
- rails-dom-testing (~> 2.0)
30
- actionpack (6.1.4.1)
31
- actionview (= 6.1.4.1)
32
- activesupport (= 6.1.4.1)
33
- rack (~> 2.0, >= 2.0.9)
11
+ actionpack (7.0.2.2)
12
+ actionview (= 7.0.2.2)
13
+ activesupport (= 7.0.2.2)
14
+ rack (~> 2.0, >= 2.2.0)
34
15
  rack-test (>= 0.6.3)
35
16
  rails-dom-testing (~> 2.0)
36
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.4.1)
38
- actionpack (= 6.1.4.1)
39
- activerecord (= 6.1.4.1)
40
- activestorage (= 6.1.4.1)
41
- activesupport (= 6.1.4.1)
18
+ actiontext (7.0.2.2)
19
+ actionpack (= 7.0.2.2)
20
+ activerecord (= 7.0.2.2)
21
+ activestorage (= 7.0.2.2)
22
+ activesupport (= 7.0.2.2)
23
+ globalid (>= 0.6.0)
42
24
  nokogiri (>= 1.8.5)
43
- actionview (6.1.4.1)
44
- activesupport (= 6.1.4.1)
25
+ actionview (7.0.2.2)
26
+ activesupport (= 7.0.2.2)
45
27
  builder (~> 3.1)
46
28
  erubi (~> 1.4)
47
29
  rails-dom-testing (~> 2.0)
48
30
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.4.1)
50
- activesupport (= 6.1.4.1)
31
+ activejob (7.0.2.2)
32
+ activesupport (= 7.0.2.2)
51
33
  globalid (>= 0.3.6)
52
- activemodel (6.1.4.1)
53
- activesupport (= 6.1.4.1)
54
- activerecord (6.1.4.1)
55
- activemodel (= 6.1.4.1)
56
- activesupport (= 6.1.4.1)
57
- activestorage (6.1.4.1)
58
- actionpack (= 6.1.4.1)
59
- activejob (= 6.1.4.1)
60
- activerecord (= 6.1.4.1)
61
- activesupport (= 6.1.4.1)
62
- marcel (~> 1.0.0)
34
+ activemodel (7.0.2.2)
35
+ activesupport (= 7.0.2.2)
36
+ activerecord (7.0.2.2)
37
+ activemodel (= 7.0.2.2)
38
+ activesupport (= 7.0.2.2)
39
+ activestorage (7.0.2.2)
40
+ actionpack (= 7.0.2.2)
41
+ activejob (= 7.0.2.2)
42
+ activerecord (= 7.0.2.2)
43
+ activesupport (= 7.0.2.2)
44
+ marcel (~> 1.0)
63
45
  mini_mime (>= 1.1.0)
64
- activesupport (6.1.4.1)
46
+ activesupport (7.0.2.2)
65
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
48
  i18n (>= 1.6, < 2)
67
49
  minitest (>= 5.1)
68
50
  tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
51
  builder (3.2.4)
71
52
  concurrent-ruby (1.1.9)
72
53
  crass (1.0.6)
73
54
  erubi (1.10.0)
74
- globalid (0.5.2)
55
+ globalid (1.0.0)
75
56
  activesupport (>= 5.0)
76
- i18n (1.8.10)
57
+ i18n (1.10.0)
77
58
  concurrent-ruby (~> 1.0)
78
- loofah (2.12.0)
59
+ loofah (2.14.0)
79
60
  crass (~> 1.0.2)
80
61
  nokogiri (>= 1.5.9)
81
- mail (2.7.1)
82
- mini_mime (>= 0.1.1)
83
62
  marcel (1.0.2)
84
- method_source (1.0.0)
85
- mini_mime (1.1.1)
86
- minitest (5.14.4)
87
- mobility (1.2.2)
63
+ mini_mime (1.1.2)
64
+ minitest (5.15.0)
65
+ mobility (1.2.5)
88
66
  i18n (>= 0.6.10, < 2)
89
67
  request_store (~> 1.0)
90
- nio4r (2.5.8)
91
- nokogiri (1.12.5-x86_64-darwin)
68
+ nokogiri (1.13.3-x86_64-darwin)
92
69
  racc (~> 1.4)
93
- nokogiri (1.12.5-x86_64-linux)
70
+ nokogiri (1.13.3-x86_64-linux)
94
71
  racc (~> 1.4)
95
- racc (1.5.2)
72
+ racc (1.6.0)
96
73
  rack (2.2.3)
97
74
  rack-test (1.1.0)
98
75
  rack (>= 1.0, < 3)
99
- rails (6.1.4.1)
100
- actioncable (= 6.1.4.1)
101
- actionmailbox (= 6.1.4.1)
102
- actionmailer (= 6.1.4.1)
103
- actionpack (= 6.1.4.1)
104
- actiontext (= 6.1.4.1)
105
- actionview (= 6.1.4.1)
106
- activejob (= 6.1.4.1)
107
- activemodel (= 6.1.4.1)
108
- activerecord (= 6.1.4.1)
109
- activestorage (= 6.1.4.1)
110
- activesupport (= 6.1.4.1)
111
- bundler (>= 1.15.0)
112
- railties (= 6.1.4.1)
113
- sprockets-rails (>= 2.0.0)
114
76
  rails-dom-testing (2.0.3)
115
77
  activesupport (>= 4.2.0)
116
78
  nokogiri (>= 1.6)
117
79
  rails-html-sanitizer (1.4.2)
118
80
  loofah (~> 2.3)
119
- railties (6.1.4.1)
120
- actionpack (= 6.1.4.1)
121
- activesupport (= 6.1.4.1)
122
- method_source
123
- rake (>= 0.13)
124
- thor (~> 1.0)
125
81
  rake (13.0.6)
126
- request_store (1.5.0)
82
+ request_store (1.5.1)
127
83
  rack (>= 1.4)
128
- sprockets (4.0.2)
129
- concurrent-ruby (~> 1.0)
130
- rack (> 1, < 3)
131
- sprockets-rails (3.2.2)
132
- actionpack (>= 4.0)
133
- activesupport (>= 4.0)
134
- sprockets (>= 3.0.0)
135
84
  sqlite3 (1.4.2)
136
- thor (1.1.0)
137
85
  tzinfo (2.0.4)
138
86
  concurrent-ruby (~> 1.0)
139
- websocket-driver (0.7.5)
140
- websocket-extensions (>= 0.1.0)
141
- websocket-extensions (0.1.5)
142
- zeitwerk (2.4.2)
143
87
 
144
88
  PLATFORMS
145
- x86_64-darwin-20
89
+ x86_64-darwin
146
90
  x86_64-linux
147
91
 
148
92
  DEPENDENCIES
149
93
  mobility-actiontext!
94
+ rake (~> 13.0)
150
95
  sqlite3 (~> 1.4)
151
96
 
152
97
  BUNDLED WITH
153
- 2.2.23
98
+ 2.3.7
data/README.md CHANGED
@@ -79,7 +79,7 @@ This is done through the `Mobility::Backends::ActionText::Translation` model ext
79
79
 
80
80
  After checking out the repo, run `bundle install` to install dependencies. Then, run `cd test_app && bundle exec rails test` to run the tests.
81
81
 
82
- To release a new version, update `lib/mobility/action_text/version.rb` and `CHANGELOG.md`, commit, then run `bundle exec rake release`. This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
82
+ To release a new version, update `lib/mobility/action_text/version.rb` and `CHANGELOG.md`, run `bundle && cd test_app && bundle`, commit, then run `bundle exec rake release`. This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
83
83
 
84
84
  ## Contributing
85
85
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mobility
4
4
  module ActionText
5
- VERSION = '0.3.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
@@ -70,7 +70,9 @@ module Mobility
70
70
  end
71
71
  end
72
72
 
73
- setup do |attributes, _options|
73
+ setup do |attributes, options|
74
+ next if options[:plain]
75
+
74
76
  attributes.each do |name|
75
77
  has_one :"rich_text_#{name}", -> { where(name: name, locale: Mobility.locale) },
76
78
  class_name: 'Mobility::Backends::ActionText::RichTextTranslation',
@@ -78,7 +80,15 @@ module Mobility
78
80
  scope :"with_rich_text_#{name}", -> { includes("rich_text_#{name}") }
79
81
  scope :"with_rich_text_#{name}_and_embeds",
80
82
  -> { includes("rich_text_#{name}": { embeds_attachments: :blob }) }
81
- end unless _options[:plain]
83
+ end
84
+
85
+ singleton_class.prepend(WithAllRichText) unless singleton_class < WithAllRichText
86
+ end
87
+
88
+ module WithAllRichText
89
+ def with_all_rich_text
90
+ super.eager_load(:rich_text_translations)
91
+ end
82
92
  end
83
93
 
84
94
  module ActionTextValidations
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
27
  spec.require_paths = ['lib']
28
28
 
29
+ spec.add_dependency 'actiontext', '>= 6.0'
29
30
  spec.add_dependency 'mobility', '~> 1.2'
30
- spec.add_dependency 'rails', '~> 6.0'
31
31
 
32
32
  spec.add_development_dependency 'sqlite3', '~> 1.4'
33
33
  end
data/test_app/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
- ruby '3.0.2'
4
+ ruby '3.1.1'
5
5
 
6
6
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
- gem 'rails', '~> 6.1.1'
7
+ gem 'rails', '~> 7.0.0'
8
8
  # Use sqlite3 as the database for Active Record
9
9
  gem 'sqlite3', '~> 1.4'
10
10
  # Use Puma as the app server
@@ -1,144 +1,168 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- mobility-actiontext (0.3.0)
4
+ mobility-actiontext (0.6.0)
5
+ actiontext (>= 6.0)
5
6
  mobility (~> 1.2)
6
- rails (~> 6.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.4.1)
12
- actionpack (= 6.1.4.1)
13
- activesupport (= 6.1.4.1)
11
+ actioncable (7.0.2.2)
12
+ actionpack (= 7.0.2.2)
13
+ activesupport (= 7.0.2.2)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.4.1)
17
- actionpack (= 6.1.4.1)
18
- activejob (= 6.1.4.1)
19
- activerecord (= 6.1.4.1)
20
- activestorage (= 6.1.4.1)
21
- activesupport (= 6.1.4.1)
16
+ actionmailbox (7.0.2.2)
17
+ actionpack (= 7.0.2.2)
18
+ activejob (= 7.0.2.2)
19
+ activerecord (= 7.0.2.2)
20
+ activestorage (= 7.0.2.2)
21
+ activesupport (= 7.0.2.2)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.4.1)
24
- actionpack (= 6.1.4.1)
25
- actionview (= 6.1.4.1)
26
- activejob (= 6.1.4.1)
27
- activesupport (= 6.1.4.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.2.2)
27
+ actionpack (= 7.0.2.2)
28
+ actionview (= 7.0.2.2)
29
+ activejob (= 7.0.2.2)
30
+ activesupport (= 7.0.2.2)
28
31
  mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
29
35
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.4.1)
31
- actionview (= 6.1.4.1)
32
- activesupport (= 6.1.4.1)
33
- rack (~> 2.0, >= 2.0.9)
36
+ actionpack (7.0.2.2)
37
+ actionview (= 7.0.2.2)
38
+ activesupport (= 7.0.2.2)
39
+ rack (~> 2.0, >= 2.2.0)
34
40
  rack-test (>= 0.6.3)
35
41
  rails-dom-testing (~> 2.0)
36
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.4.1)
38
- actionpack (= 6.1.4.1)
39
- activerecord (= 6.1.4.1)
40
- activestorage (= 6.1.4.1)
41
- activesupport (= 6.1.4.1)
43
+ actiontext (7.0.2.2)
44
+ actionpack (= 7.0.2.2)
45
+ activerecord (= 7.0.2.2)
46
+ activestorage (= 7.0.2.2)
47
+ activesupport (= 7.0.2.2)
48
+ globalid (>= 0.6.0)
42
49
  nokogiri (>= 1.8.5)
43
- actionview (6.1.4.1)
44
- activesupport (= 6.1.4.1)
50
+ actionview (7.0.2.2)
51
+ activesupport (= 7.0.2.2)
45
52
  builder (~> 3.1)
46
53
  erubi (~> 1.4)
47
54
  rails-dom-testing (~> 2.0)
48
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.4.1)
50
- activesupport (= 6.1.4.1)
56
+ activejob (7.0.2.2)
57
+ activesupport (= 7.0.2.2)
51
58
  globalid (>= 0.3.6)
52
- activemodel (6.1.4.1)
53
- activesupport (= 6.1.4.1)
54
- activerecord (6.1.4.1)
55
- activemodel (= 6.1.4.1)
56
- activesupport (= 6.1.4.1)
57
- activestorage (6.1.4.1)
58
- actionpack (= 6.1.4.1)
59
- activejob (= 6.1.4.1)
60
- activerecord (= 6.1.4.1)
61
- activesupport (= 6.1.4.1)
62
- marcel (~> 1.0.0)
59
+ activemodel (7.0.2.2)
60
+ activesupport (= 7.0.2.2)
61
+ activerecord (7.0.2.2)
62
+ activemodel (= 7.0.2.2)
63
+ activesupport (= 7.0.2.2)
64
+ activestorage (7.0.2.2)
65
+ actionpack (= 7.0.2.2)
66
+ activejob (= 7.0.2.2)
67
+ activerecord (= 7.0.2.2)
68
+ activesupport (= 7.0.2.2)
69
+ marcel (~> 1.0)
63
70
  mini_mime (>= 1.1.0)
64
- activesupport (6.1.4.1)
71
+ activesupport (7.0.2.2)
65
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
73
  i18n (>= 1.6, < 2)
67
74
  minitest (>= 5.1)
68
75
  tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
76
  bindex (0.8.1)
71
77
  builder (3.2.4)
72
78
  byebug (11.1.3)
73
79
  concurrent-ruby (1.1.9)
74
80
  crass (1.0.6)
81
+ digest (3.1.0)
75
82
  erubi (1.10.0)
76
- ffi (1.15.4)
77
- globalid (0.5.2)
83
+ ffi (1.15.5)
84
+ globalid (1.0.0)
78
85
  activesupport (>= 5.0)
79
- i18n (1.8.10)
86
+ i18n (1.10.0)
80
87
  concurrent-ruby (~> 1.0)
81
- jbuilder (2.11.2)
88
+ io-wait (0.2.1)
89
+ jbuilder (2.11.5)
90
+ actionview (>= 5.0.0)
82
91
  activesupport (>= 5.0.0)
83
- listen (3.7.0)
92
+ listen (3.7.1)
84
93
  rb-fsevent (~> 0.10, >= 0.10.3)
85
94
  rb-inotify (~> 0.9, >= 0.9.10)
86
- loofah (2.12.0)
95
+ loofah (2.14.0)
87
96
  crass (~> 1.0.2)
88
97
  nokogiri (>= 1.5.9)
89
98
  mail (2.7.1)
90
99
  mini_mime (>= 0.1.1)
91
100
  marcel (1.0.2)
92
101
  method_source (1.0.0)
93
- mini_mime (1.1.1)
94
- minitest (5.14.4)
95
- mobility (1.2.2)
102
+ mini_mime (1.1.2)
103
+ minitest (5.15.0)
104
+ mobility (1.2.5)
96
105
  i18n (>= 0.6.10, < 2)
97
106
  request_store (~> 1.0)
107
+ net-imap (0.2.3)
108
+ digest
109
+ net-protocol
110
+ strscan
111
+ net-pop (0.1.1)
112
+ digest
113
+ net-protocol
114
+ timeout
115
+ net-protocol (0.1.2)
116
+ io-wait
117
+ timeout
118
+ net-smtp (0.3.1)
119
+ digest
120
+ net-protocol
121
+ timeout
98
122
  nio4r (2.5.8)
99
- nokogiri (1.12.5-x86_64-darwin)
123
+ nokogiri (1.13.3-x86_64-darwin)
100
124
  racc (~> 1.4)
101
- nokogiri (1.12.5-x86_64-linux)
125
+ nokogiri (1.13.3-x86_64-linux)
102
126
  racc (~> 1.4)
103
- puma (5.5.0)
127
+ puma (5.6.2)
104
128
  nio4r (~> 2.0)
105
- racc (1.5.2)
129
+ racc (1.6.0)
106
130
  rack (2.2.3)
107
- rack-mini-profiler (2.3.3)
131
+ rack-mini-profiler (2.3.4)
108
132
  rack (>= 1.2.0)
109
133
  rack-test (1.1.0)
110
134
  rack (>= 1.0, < 3)
111
- rails (6.1.4.1)
112
- actioncable (= 6.1.4.1)
113
- actionmailbox (= 6.1.4.1)
114
- actionmailer (= 6.1.4.1)
115
- actionpack (= 6.1.4.1)
116
- actiontext (= 6.1.4.1)
117
- actionview (= 6.1.4.1)
118
- activejob (= 6.1.4.1)
119
- activemodel (= 6.1.4.1)
120
- activerecord (= 6.1.4.1)
121
- activestorage (= 6.1.4.1)
122
- activesupport (= 6.1.4.1)
135
+ rails (7.0.2.2)
136
+ actioncable (= 7.0.2.2)
137
+ actionmailbox (= 7.0.2.2)
138
+ actionmailer (= 7.0.2.2)
139
+ actionpack (= 7.0.2.2)
140
+ actiontext (= 7.0.2.2)
141
+ actionview (= 7.0.2.2)
142
+ activejob (= 7.0.2.2)
143
+ activemodel (= 7.0.2.2)
144
+ activerecord (= 7.0.2.2)
145
+ activestorage (= 7.0.2.2)
146
+ activesupport (= 7.0.2.2)
123
147
  bundler (>= 1.15.0)
124
- railties (= 6.1.4.1)
125
- sprockets-rails (>= 2.0.0)
148
+ railties (= 7.0.2.2)
126
149
  rails-dom-testing (2.0.3)
127
150
  activesupport (>= 4.2.0)
128
151
  nokogiri (>= 1.6)
129
152
  rails-html-sanitizer (1.4.2)
130
153
  loofah (~> 2.3)
131
- railties (6.1.4.1)
132
- actionpack (= 6.1.4.1)
133
- activesupport (= 6.1.4.1)
154
+ railties (7.0.2.2)
155
+ actionpack (= 7.0.2.2)
156
+ activesupport (= 7.0.2.2)
134
157
  method_source
135
- rake (>= 0.13)
158
+ rake (>= 12.2)
136
159
  thor (~> 1.0)
160
+ zeitwerk (~> 2.5)
137
161
  rake (13.0.6)
138
- rb-fsevent (0.11.0)
162
+ rb-fsevent (0.11.1)
139
163
  rb-inotify (0.10.1)
140
164
  ffi (~> 1.0)
141
- request_store (1.5.0)
165
+ request_store (1.5.1)
142
166
  rack (>= 1.4)
143
167
  sass-rails (6.0.0)
144
168
  sassc-rails (~> 2.1, >= 2.1.1)
@@ -153,19 +177,21 @@ GEM
153
177
  sprockets (4.0.2)
154
178
  concurrent-ruby (~> 1.0)
155
179
  rack (> 1, < 3)
156
- sprockets-rails (3.2.2)
157
- actionpack (>= 4.0)
158
- activesupport (>= 4.0)
180
+ sprockets-rails (3.4.2)
181
+ actionpack (>= 5.2)
182
+ activesupport (>= 5.2)
159
183
  sprockets (>= 3.0.0)
160
184
  sqlite3 (1.4.2)
161
- thor (1.1.0)
185
+ strscan (3.0.1)
186
+ thor (1.2.1)
162
187
  tilt (2.0.10)
188
+ timeout (0.2.0)
163
189
  turbolinks (5.2.1)
164
190
  turbolinks-source (~> 5.2)
165
191
  turbolinks-source (5.2.0)
166
192
  tzinfo (2.0.4)
167
193
  concurrent-ruby (~> 1.0)
168
- web-console (4.1.0)
194
+ web-console (4.2.0)
169
195
  actionview (>= 6.0.0)
170
196
  activemodel (>= 6.0.0)
171
197
  bindex (>= 0.4.0)
@@ -173,10 +199,10 @@ GEM
173
199
  websocket-driver (0.7.5)
174
200
  websocket-extensions (>= 0.1.0)
175
201
  websocket-extensions (0.1.5)
176
- zeitwerk (2.4.2)
202
+ zeitwerk (2.5.4)
177
203
 
178
204
  PLATFORMS
179
- x86_64-darwin-20
205
+ x86_64-darwin
180
206
  x86_64-linux
181
207
 
182
208
  DEPENDENCIES
@@ -187,7 +213,7 @@ DEPENDENCIES
187
213
  mobility-actiontext!
188
214
  puma (~> 5.0)
189
215
  rack-mini-profiler (~> 2.0)
190
- rails (~> 6.1.1)
216
+ rails (~> 7.0.0)
191
217
  sass-rails (>= 6)
192
218
  sqlite3 (~> 1.4)
193
219
  turbolinks (~> 5)
@@ -195,7 +221,7 @@ DEPENDENCIES
195
221
  web-console (>= 4.1.0)
196
222
 
197
223
  RUBY VERSION
198
- ruby 3.0.2p107
224
+ ruby 3.1.1p18
199
225
 
200
226
  BUNDLED WITH
201
- 2.2.23
227
+ 2.3.7
@@ -4,4 +4,6 @@ class Post < ApplicationRecord
4
4
  extend Mobility
5
5
  translates :title, plain: true
6
6
  translates :content
7
+
8
+ has_rich_text :non_i18n_content
7
9
  end
@@ -3,7 +3,7 @@
3
3
  class TranslateRichTexts < ActiveRecord::Migration[6.1]
4
4
  def change
5
5
  # or null: true to allow untranslated rich text
6
- add_column :action_text_rich_texts, :locale, :string, null: false
6
+ add_column :action_text_rich_texts, :locale, :string, null: true
7
7
 
8
8
  remove_index :action_text_rich_texts,
9
9
  column: %i[record_type record_id name],
@@ -20,7 +20,7 @@ ActiveRecord::Schema.define(version: 20_210_114_125_134) do
20
20
  t.integer 'record_id', null: false
21
21
  t.datetime 'created_at', precision: 6, null: false
22
22
  t.datetime 'updated_at', precision: 6, null: false
23
- t.string 'locale', null: false
23
+ t.string 'locale'
24
24
  t.index %w[record_type record_id name locale], name: 'index_action_text_rich_texts_uniqueness',
25
25
  unique: true
26
26
  end
@@ -22,6 +22,11 @@ post_one_content_fr:
22
22
  locale: fr
23
23
  body: <h1>Bonjour le monde !</h1>
24
24
 
25
+ post_one_non_i18n_content:
26
+ record: one (Post)
27
+ name: non_i18n_content
28
+ body: <h1>Hello non i18n world!</h1>
29
+
25
30
  untranslated_title_en:
26
31
  record: untranslated (Post)
27
32
  name: title
@@ -95,7 +95,7 @@ module Mobility
95
95
  end
96
96
  end
97
97
 
98
- test 'post content is eager loaded' do
98
+ test 'post content is eager loaded explicitly' do
99
99
  post = assert_queries(2) { Post.with_rich_text_content.last }
100
100
 
101
101
  assert_no_queries do
@@ -105,8 +105,24 @@ module Mobility
105
105
  end
106
106
  end
107
107
 
108
+ test 'post content is eager loaded with all rich text' do
109
+ post = assert_queries(2) { Post.with_all_rich_text.last }
110
+
111
+ assert_no_queries do
112
+ assert_equal 'Hello world!', post.content.to_plain_text
113
+ end
114
+ end
115
+
116
+ test 'post non_i18n_content is eager loaded with all rich text' do
117
+ post = assert_queries(2) { Post.with_all_rich_text.last }
118
+
119
+ assert_no_queries do
120
+ assert_equal 'Hello non i18n world!', post.non_i18n_content.to_plain_text
121
+ end
122
+ end
123
+
108
124
  test 'post is being destroyed' do
109
- assert_difference ->{Mobility::Backends::ActionText::RichTextTranslation.count}, -4 do
125
+ assert_difference ->{Mobility::Backends::ActionText::RichTextTranslation.count}, -5 do
110
126
  assert posts(:one).destroy
111
127
  end
112
128
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility-actiontext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.6.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: 2021-10-07 00:00:00.000000000 Z
11
+ date: 2022-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mobility
14
+ name: actiontext
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: mobility
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
33
+ version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '6.0'
40
+ version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.2.23
157
+ rubygems_version: 3.3.7
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Translate Rails Action Text rich text with Mobility.