Skip to content

Commit e3a922d

Browse files
committed
Update factory bot and mobility gems
1 parent fe6b3b2 commit e3a922d

File tree

3 files changed

+123
-116
lines changed

3 files changed

+123
-116
lines changed

Gemfile.lock

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ PATH
1515
devise
1616
devise-jwt
1717
friendly_id (>= 5.2, < 5.5)
18-
friendly_id-mobility (~> 0.5.4)
18+
friendly_id-mobility (~> 1.0.4)
1919
jsonapi-resources (>= 0.10.0)
20-
mobility (~> 0.8.6)
20+
mobility (~> 1.2, >= 1.2.9)
2121
pundit (~> 2.1.0)
2222
pundit-resources
2323
rack-cors (~> 1.1.1)
@@ -86,10 +86,8 @@ GEM
8686
minitest (>= 5.1)
8787
tzinfo (~> 2.0)
8888
zeitwerk (~> 2.3)
89-
addressable (2.8.1)
89+
addressable (2.8.4)
9090
public_suffix (>= 2.0.2, < 6.0)
91-
archive-zip (0.12.0)
92-
io-like (~> 0.3.0)
9391
ast (2.4.2)
9492
bcrypt (3.1.18)
9593
better_errors (2.9.1)
@@ -137,19 +135,19 @@ GEM
137135
zeitwerk (~> 2.6)
138136
erubi (1.12.0)
139137
execjs (2.8.1)
140-
factory_bot (6.1.0)
138+
factory_bot (6.2.1)
141139
activesupport (>= 5.0.0)
142-
factory_bot_rails (6.1.0)
143-
factory_bot (~> 6.1.0)
140+
factory_bot_rails (6.2.0)
141+
factory_bot (~> 6.2.0)
144142
railties (>= 5.0.0)
145143
faker (3.0.0)
146144
i18n (>= 1.8.11, < 2)
147145
ffi (1.15.5)
148-
friendly_id (5.4.0)
146+
friendly_id (5.4.2)
149147
activerecord (>= 4.0.0)
150-
friendly_id-mobility (0.5.5)
151-
friendly_id (>= 5.0.0, <= 5.4.0)
152-
mobility (>= 0.5.1, < 1.0)
148+
friendly_id-mobility (1.0.4)
149+
friendly_id (>= 5.0.0, < 5.5)
150+
mobility (>= 1.0.1, < 2.0)
153151
fuubar (2.5.1)
154152
rspec-core (~> 3.0)
155153
ruby-progressbar (~> 1.4)
@@ -158,9 +156,8 @@ GEM
158156
http-accept (1.7.0)
159157
http-cookie (1.0.3)
160158
domain_name (~> 0.5)
161-
i18n (1.12.0)
159+
i18n (1.14.1)
162160
concurrent-ruby (~> 1.0)
163-
io-like (0.3.1)
164161
json (2.6.3)
165162
json-schema (2.8.1)
166163
addressable (>= 2.4)
@@ -172,24 +169,23 @@ GEM
172169
listen (3.7.1)
173170
rb-fsevent (~> 0.10, >= 0.10.3)
174171
rb-inotify (~> 0.9, >= 0.9.10)
175-
loofah (2.19.1)
172+
loofah (2.21.3)
176173
crass (~> 1.0.2)
177-
nokogiri (>= 1.5.9)
174+
nokogiri (>= 1.12.0)
178175
mail (2.8.1)
179176
mini_mime (>= 0.1.1)
180177
net-imap
181178
net-pop
182179
net-smtp
183180
marcel (1.0.2)
184-
matrix (0.4.2)
185181
method_source (1.0.0)
186182
mime-types (3.3.1)
187183
mime-types-data (~> 3.2015)
188184
mime-types-data (3.2020.1104)
189185
mini_mime (1.1.2)
190-
mini_portile2 (2.8.1)
186+
mini_portile2 (2.8.2)
191187
minitest (5.18.0)
192-
mobility (0.8.13)
188+
mobility (1.2.9)
193189
i18n (>= 0.6.10, < 2)
194190
request_store (~> 1.0)
195191
msgpack (1.3.3)
@@ -205,15 +201,15 @@ GEM
205201
net-protocol
206202
netrc (0.11.0)
207203
nio4r (2.5.8)
208-
nokogiri (1.14.2)
209-
mini_portile2 (~> 2.8.0)
204+
nokogiri (1.15.2)
205+
mini_portile2 (~> 2.8.2)
210206
racc (~> 1.4)
211207
optimist (3.0.1)
212208
orm_adapter (0.5.0)
213209
parallel (1.22.1)
214210
parser (3.1.3.0)
215211
ast (~> 2.4.1)
216-
pg (1.2.3)
212+
pg (1.5.3)
217213
pry (0.14.1)
218214
coderay (~> 1.1)
219215
method_source (~> 1.0)
@@ -223,7 +219,7 @@ GEM
223219
pundit (2.1.1)
224220
activesupport (>= 3.0.0)
225221
racc (1.6.2)
226-
rack (2.2.6.4)
222+
rack (2.2.7)
227223
rack-cors (1.1.1)
228224
rack (>= 2.0.0)
229225
rack-mini-profiler (3.0.0)
@@ -248,8 +244,9 @@ GEM
248244
rails-dom-testing (2.0.3)
249245
activesupport (>= 4.2.0)
250246
nokogiri (>= 1.6)
251-
rails-html-sanitizer (1.5.0)
252-
loofah (~> 2.19, >= 2.19.1)
247+
rails-html-sanitizer (1.6.0)
248+
loofah (~> 2.21)
249+
nokogiri (~> 1.14)
253250
railties (6.1.7.3)
254251
actionpack (= 6.1.7.3)
255252
activesupport (= 6.1.7.3)
@@ -266,7 +263,7 @@ GEM
266263
ffi (>= 1.0.6)
267264
msgpack (>= 0.4.3)
268265
optimist (>= 3.0.0)
269-
regexp_parser (2.6.1)
266+
regexp_parser (2.8.0)
270267
request_store (1.5.1)
271268
rack (>= 1.4)
272269
responders (3.0.1)
@@ -321,11 +318,6 @@ GEM
321318
rubocop-ast (1.24.0)
322319
parser (>= 3.1.1.0)
323320
ruby-progressbar (1.11.0)
324-
rubyzip (2.3.2)
325-
selenium-webdriver (4.7.1)
326-
rexml (~> 3.2, >= 3.2.5)
327-
rubyzip (>= 1.2.2, < 3.0)
328-
websocket (~> 1.0)
329321
shoulda-callback-matchers (1.1.4)
330322
activesupport (>= 3)
331323
shoulda-matchers (5.0.0)
@@ -350,7 +342,7 @@ GEM
350342
sync (0.5.0)
351343
term-ansicolor (1.7.1)
352344
tins (~> 1.0)
353-
thor (1.2.1)
345+
thor (1.2.2)
354346
timeout (0.3.2)
355347
tins (1.26.0)
356348
sync
@@ -372,13 +364,10 @@ GEM
372364
activemodel (>= 6.0.0)
373365
bindex (>= 0.4.0)
374366
railties (>= 6.0.0)
375-
websocket (1.2.9)
376367
websocket-driver (0.7.5)
377368
websocket-extensions (>= 0.1.0)
378369
websocket-extensions (0.1.5)
379-
xpath (3.2.0)
380-
nokogiri (~> 1.8)
381-
zeitwerk (2.6.7)
370+
zeitwerk (2.6.8)
382371

383372
PLATFORMS
384373
ruby

better_together.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
3131
spec.add_dependency 'rails', '>= 5.2.2', '< 7.1.0'
3232
spec.add_dependency 'friendly_id', '>= 5.2', '< 5.5'
3333
spec.add_dependency 'jsonapi-resources', '>= 0.10.0'
34-
spec.add_dependency 'mobility', '~> 0.8.6'
35-
spec.add_dependency 'friendly_id-mobility', '~> 0.5.4'
34+
spec.add_dependency 'mobility', '~> 1.2', '>= 1.2.9'
35+
spec.add_dependency 'friendly_id-mobility', '~> 1.0.4'
3636
spec.add_dependency 'pundit', '~> 2.1.0'
3737
spec.add_dependency 'pundit-resources'
3838
spec.add_dependency 'rack-cors', '~> 1.1.1'

config/initializers/mobility.rb

Lines changed: 96 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,108 @@
11
Mobility.configure do |config|
2-
# Sets the default backend to use in models. This can be overridden in models
3-
# by passing +backend: ...+ to +translates+.
4-
config.default_backend = :key_value
52

6-
# By default, Mobility uses the +translates+ class method in models to
7-
# describe translated attributes, but you can configure this method to be
8-
# whatever you like. This may be useful if using Mobility alongside another
9-
# translation gem which uses the same method name.
10-
config.accessor_method = :translates
3+
# PLUGINS
4+
config.plugins do
5+
# Backend
6+
#
7+
# Sets the default backend to use in models. This can be overridden in models
8+
# by passing +backend: ...+ to +translates+.
9+
#
10+
# To default to a different backend globally, replace +:key_value+ by another
11+
# backend name.
12+
#
13+
backend :key_value, type: :text
1114

12-
# To query on translated attributes, you need to append a scope to your
13-
# model. The name of this scope is +i18n+ by default, but this can be changed
14-
# to something else.
15-
config.query_method = :i18n
15+
# ActiveRecord
16+
#
17+
# Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins.
18+
active_record
1619

17-
# Uncomment and remove (or add) items to (from) this list to completely
18-
# disable/enable plugins globally (so they cannot be used and are never even
19-
# loaded). Note that if you remove an item from the list, you will not be
20-
# able to use the plugin at all, and any options for the plugin will be
21-
# ignored by models. (In most cases, you probably don't want to change this.)
22-
#
23-
# config.plugins = %i[
24-
# query
25-
# cache
26-
# dirty
27-
# fallbacks
28-
# presence
29-
# default
30-
# attribute_methods
31-
# fallthrough_accessors
32-
# locale_accessors
33-
# ]
20+
# Accessors
21+
#
22+
# Define reader and writer methods for translated attributes. Remove either
23+
# to disable globally, or pass +reader: false+ or +writer: false+ to
24+
# +translates+ in any translated model.
25+
#
26+
reader
27+
writer
3428

35-
# The translation cache is on by default, but you can turn it off by
36-
# uncommenting this line. (This may be helpful in debugging.)
37-
#
38-
# config.default_options[:cache] = false
29+
# Backend Reader
30+
#
31+
# Defines reader to access the backend for any attribute, of the form
32+
# +<attribute>_backend+.
33+
#
34+
backend_reader
35+
#
36+
# Or pass an interpolation string to define a different pattern:
37+
# backend_reader "%s_translations"
3938

40-
# Dirty tracking is disabled by default. Uncomment this line to enable it.
41-
# If you enable this, you should also enable +locale_accessors+ by default
42-
# (see below).
43-
#
44-
# config.default_options[:dirty] = true
39+
# Query
40+
#
41+
# Defines a scope on the model class which allows querying on
42+
# translated attributes. The default scope is named +i18n+, pass a different
43+
# name as default to change the global default, or to +translates+ in any
44+
# model to change it for that model alone.
45+
#
46+
query
4547

46-
# No fallbacks are used by default. To define default fallbacks, uncomment
47-
# and set the default fallback option value here. A "true" value will use
48-
# whatever is defined by +I18n.fallbacks+ (if defined), or alternatively will
49-
# fallback to your +I18n.default_locale+.
50-
#
51-
config.default_options[:fallbacks] = true
48+
# Cache
49+
#
50+
# Comment out to disable caching reads and writes.
51+
#
52+
cache
5253

53-
# The Presence plugin converts empty strings to nil when fetching and setting
54-
# translations. By default it is on, uncomment this line to turn it off.
55-
#
56-
# config.default_options[:presence] = false
54+
# Dirty
55+
#
56+
# Uncomment this line to include and enable globally:
57+
# dirty
58+
#
59+
# Or uncomment this line to include but disable by default, and only enable
60+
# per model by passing +dirty: true+ to +translates+.
61+
# dirty false
5762

58-
# Set a default value to use if the translation is nil. By default this is
59-
# off, uncomment and set a default to use it across all models (you probably
60-
# don't want to do that).
61-
#
62-
# config.default_options[:default] = ...
63+
# Fallbacks
64+
#
65+
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+.
66+
fallbacks
67+
#
68+
# Or uncomment this line to enable fallbacks with a global default.
69+
# fallbacks { :pt => :en }
6370

64-
# Uncomment to enable locale_accessors by default on models. A true value
65-
# will use the locales defined either in
66-
# Rails.application.config.i18n.available_locales or I18n.available_locales.
67-
# If you want something else, pass an array of locales instead.
68-
#
69-
config.default_options[:locale_accessors] = true
71+
# Presence
72+
#
73+
# Converts blank strings to nil on reads and writes. Comment out to
74+
# disable.
75+
#
76+
presence
7077

71-
# Uncomment to enable fallthrough accessors by default on models. This will
72-
# allow you to call any method with a suffix like _en or _pt_br, and Mobility
73-
# will catch the suffix and convert it into a locale in +method_missing+. If
74-
# you don't need this kind of open-ended fallthrough behavior, it's better
75-
# to use locale_accessors instead (which define methods) since method_missing
76-
# is very slow. (You can use both fallthrough and locale accessor plugins
77-
# together without conflict.)
78-
#
79-
# Note: The dirty plugin enables fallthrough_accessors by default.
80-
#
81-
# config.default_options[:fallthrough_accessors] = true
78+
# Default
79+
#
80+
# Set a default translation per attributes. When enabled, passing +default:
81+
# 'foo'+ sets a default translation string to show in case no translation is
82+
# present. Can also be passed a proc.
83+
#
84+
# default 'foo'
8285

83-
# You can also include backend-specific default options. For example, if you
84-
# want to default to using the text-type translation table with the KeyValue
85-
# backend, you can set that as a default by uncommenting this line, or change
86-
# it to :string to default to the string-type translation table instead. (For
87-
# other backends, this option is ignored.)
88-
#
89-
config.default_options[:type] = :string
90-
end
86+
# Fallthrough Accessors
87+
#
88+
# Uses method_missing to define locale-specific accessor methods like
89+
# +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated
90+
# attribute. If you know what set of locales you want to support, it's
91+
# generally better to use Locale Accessors (or both together) since
92+
# +method_missing+ is very slow. (You can use both fallthrough and locale
93+
# accessor plugins together without conflict.)
94+
#
95+
# fallthrough_accessors
96+
97+
# Locale Accessors
98+
#
99+
# Uses +def+ to define accessor methods for a set of locales. By default uses
100+
# +I18n.available_locales+, but you can pass the set of locales with
101+
# +translates+ and/or set a global default here.
102+
#
103+
locale_accessors
104+
#
105+
# Or define specific defaults by uncommenting line below
106+
# locale_accessors [:en, :ja]
107+
end
108+
end

0 commit comments

Comments
 (0)