mobility 1.0.0.rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -3
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +20 -22
- data/lib/mobility.rb +1 -1
- data/lib/mobility/plugins/active_record/uniqueness_validation.rb +4 -0
- data/lib/mobility/version.rb +1 -1
- data/lib/rails/generators/mobility/templates/create_string_translations.rb +0 -1
- data/lib/rails/generators/mobility/templates/create_text_translations.rb +0 -1
- data/lib/rails/generators/mobility/templates/initializer.rb +9 -1
- metadata +11 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d927c413815d0bd56b1f75e5b0a352d2f5832415c4e1f8c50a98fde44d973e92
|
4
|
+
data.tar.gz: 72d484c61b6b17b9d99e1061444d209ce66a4de70f904d68d1ce612b24656ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1167adec126a34ff482d01beaa38e18e4188a79aa1be9e5031f8786d86629724984f7597c29d947ae11ad77d72c7538ecc84ed7474c70c87a3da226e81b1f59c
|
7
|
+
data.tar.gz: d64f21cab45ffa292e9980962d38c7f76fcaacdcac48b7d83b25fbcc0856b49b6814cefdc78e39382d7c12b944ef27ebedb23c14bffb6f819c972e8c9176cb43
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
8
|
2
|
-
|
3
|
-
�Օ�F?#�D�-��*�^�M�ɼ�̨��{�~��la�eY�f7 }o�<������Mye,H^��o@�^~ۦE�V0���aD��u���
|
1
|
+
Z���y�yWy��=���T�R?��6�Jl����-��a���q��te����������&�r��Ş�I�8��KJ���@FS�I�CĔm�z��1y�/�qDIe�~:�!�/��_�8�
|
2
|
+
Σ��U�π�Y��>�)��)�"0�_k�L���N6~#���o��P��^��5К%��\ M9�$�/)t����uԋ�^�t�ʎ@
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,15 @@
|
|
4
4
|
|
5
5
|
1.0 is a rewrite of many internals of the gem. Please see the [wiki page on v1.0](https://github.com/shioyama/mobility/wiki/Introduction-to-Mobility-v1.0) for more details on how to upgrade.
|
6
6
|
|
7
|
+
## 1.0.0
|
8
|
+
|
9
|
+
- Fix setting a locale from Rails config
|
10
|
+
([#468](https://github.com/shioyama/mobility/pull/468)) thanks
|
11
|
+
[sergey-alekseev](https://github.com/sergey-alekseev)!
|
12
|
+
- Fixes validations with validates_uniqueness_of
|
13
|
+
([#470](https://github.com/shioyama/mobility/pull/470)) thanks
|
14
|
+
[artplan1](https://github.com/shioyama/mobility/pull/470)!
|
15
|
+
|
7
16
|
## 1.0.0.rc1 (pre-release)
|
8
17
|
|
9
18
|
- Remove `Mobility::ActiveRecord`, `Mobility::Sequel` and `Mobility::Arel`, and
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,10 +12,8 @@ Mobility
|
|
12
12
|
[docs]: http://www.rubydoc.info/gems/mobility
|
13
13
|
[wiki]: https://github.com/shioyama/mobility/wiki
|
14
14
|
|
15
|
-
**This is the readme for
|
16
|
-
|
17
|
-
If you are using an earlier version (0.8.x or earlier), you probably want the
|
18
|
-
readme on the [0-8-stable
|
15
|
+
**This is the readme for version 1.0 of Mobility. If you are using an earlier
|
16
|
+
version (0.8.x or earlier), you probably want the readme on the [0-8-stable
|
19
17
|
branch](https://github.com/shioyama/mobility/tree/0-8-stable).**
|
20
18
|
|
21
19
|
Mobility is a gem for storing and retrieving translations as attributes on a
|
@@ -58,7 +56,7 @@ To use the latest pre-version of Mobility 1.0, add this line to your
|
|
58
56
|
application's Gemfile:
|
59
57
|
|
60
58
|
```ruby
|
61
|
-
gem 'mobility', '~> 1.0.0
|
59
|
+
gem 'mobility', '~> 1.0.0'
|
62
60
|
```
|
63
61
|
|
64
62
|
For the latest stable version of Mobility, see the readme on the
|
@@ -92,8 +90,8 @@ which looks something like this:
|
|
92
90
|
|
93
91
|
```ruby
|
94
92
|
Mobility.configure do
|
95
|
-
# PLUGINS
|
96
93
|
|
94
|
+
# PLUGINS
|
97
95
|
plugins do
|
98
96
|
backend :key_value
|
99
97
|
|
@@ -107,15 +105,15 @@ Mobility.configure do
|
|
107
105
|
end
|
108
106
|
```
|
109
107
|
|
110
|
-
Each method call inside the block passed to `
|
111
|
-
|
108
|
+
Each method call inside the block passed to `plugins` declares a plugin, along
|
109
|
+
with an optional default. To use a different default backend, you can
|
112
110
|
change the default passed to the `backend` plugin, like this:
|
113
111
|
|
114
112
|
```diff
|
115
|
-
Mobility.configure do
|
116
|
-
# PLUGINS
|
113
|
+
Mobility.configure do
|
117
114
|
|
118
|
-
|
115
|
+
# PLUGINS
|
116
|
+
plugins do
|
119
117
|
- backend :key_value
|
120
118
|
+ backend :table
|
121
119
|
```
|
@@ -126,10 +124,10 @@ You can also set defaults for backend-specific options. Below, we set the
|
|
126
124
|
default `type` option for the KeyValue backend to `:string`.
|
127
125
|
|
128
126
|
```diff
|
129
|
-
Mobility.configure do
|
130
|
-
# PLUGINS
|
127
|
+
Mobility.configure do
|
131
128
|
|
132
|
-
|
129
|
+
# PLUGINS
|
130
|
+
plugins do
|
133
131
|
- backend :key_value
|
134
132
|
+ backend :key_value, type: :string
|
135
133
|
end
|
@@ -150,7 +148,7 @@ Requirements:
|
|
150
148
|
When configuring Mobility, ensure that you include the `sequel` plugin:
|
151
149
|
|
152
150
|
```diff
|
153
|
-
|
151
|
+
plugins do
|
154
152
|
backend :key_value
|
155
153
|
|
156
154
|
- active_record
|
@@ -297,7 +295,7 @@ accessors" in Mobility, and can be enabled by including the `locale_accessors`
|
|
297
295
|
plugin, with a default set of accessors:
|
298
296
|
|
299
297
|
```diff
|
300
|
-
|
298
|
+
plugins do
|
301
299
|
# ...
|
302
300
|
+ locale_accessors [:en, :ja]
|
303
301
|
```
|
@@ -345,7 +343,7 @@ defined for a given locale.)
|
|
345
343
|
Ensure the plugin is enabled:
|
346
344
|
|
347
345
|
```diff
|
348
|
-
|
346
|
+
plugins do
|
349
347
|
# ...
|
350
348
|
+ fallthrough_accessors
|
351
349
|
```
|
@@ -470,7 +468,7 @@ Mobility offers basic support for translation fallbacks. First, enable the
|
|
470
468
|
`fallbacks` plugin:
|
471
469
|
|
472
470
|
```diff
|
473
|
-
|
471
|
+
plugins do
|
474
472
|
# ...
|
475
473
|
+ fallbacks
|
476
474
|
+ locale_accessors
|
@@ -579,7 +577,7 @@ fallbacks](https://github.com/svenfuchs/i18n/wiki/Fallbacks).
|
|
579
577
|
Another option is to assign a default value, using the `default` plugin:
|
580
578
|
|
581
579
|
```diff
|
582
|
-
|
580
|
+
plugins do
|
583
581
|
# ...
|
584
582
|
+ default 'foo'
|
585
583
|
```
|
@@ -632,7 +630,7 @@ have enabled an ORM plugin (either `active_record` or `sequel`), since the
|
|
632
630
|
dirty plugin will depend on one of these being enabled.
|
633
631
|
|
634
632
|
```diff
|
635
|
-
|
633
|
+
plugins do
|
636
634
|
# ...
|
637
635
|
active_record
|
638
636
|
+ dirty
|
@@ -722,7 +720,7 @@ can be quickly retrieved again. The cache plugin is included in the default
|
|
722
720
|
configuration created by the install generator:
|
723
721
|
|
724
722
|
```diff
|
725
|
-
|
723
|
+
plugins do
|
726
724
|
# ...
|
727
725
|
+ cache
|
728
726
|
```
|
@@ -752,7 +750,7 @@ this feature, include the `query` plugin, and ensure you also have an ORM
|
|
752
750
|
plugin enabled (`active_record` or `sequel`):
|
753
751
|
|
754
752
|
```diff
|
755
|
-
|
753
|
+
plugins do
|
756
754
|
# ...
|
757
755
|
active_record
|
758
756
|
+ query
|
data/lib/mobility.rb
CHANGED
@@ -218,7 +218,7 @@ module Mobility
|
|
218
218
|
# methods (in LocaleAccessors) than is really necessary.
|
219
219
|
def available_locales
|
220
220
|
if defined?(Rails) && Rails.application
|
221
|
-
Rails.application.config.i18n.available_locales || I18n.available_locales
|
221
|
+
Rails.application.config.i18n.available_locales&.map(&:to_sym) || I18n.available_locales
|
222
222
|
else
|
223
223
|
I18n.available_locales
|
224
224
|
end
|
@@ -10,6 +10,10 @@ module Mobility
|
|
10
10
|
klass.class_eval do
|
11
11
|
unless const_defined?(:UniquenessValidator, false)
|
12
12
|
self.const_set(:UniquenessValidator, Class.new(UniquenessValidator))
|
13
|
+
|
14
|
+
def self.validates_uniqueness_of(*attr_names)
|
15
|
+
validates_with(UniquenessValidator, _merge_attributes(attr_names))
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
end
|
data/lib/mobility/version.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
Mobility.configure do
|
2
|
-
|
3
2
|
# PLUGINS
|
4
3
|
plugins do
|
5
4
|
# Backend
|
@@ -104,5 +103,14 @@ Mobility.configure do
|
|
104
103
|
#
|
105
104
|
# Or define specific defaults by uncommenting line below
|
106
105
|
# locale_accessors [:en, :ja]
|
106
|
+
|
107
|
+
# Attribute Methods
|
108
|
+
#
|
109
|
+
# Adds translated attributes to +attributes+ hash, and defines methods
|
110
|
+
# +translated_attributes+ and +untranslated_attributes+ which return hashes
|
111
|
+
# with translatd and untranslated attributes, respectively. Be aware that
|
112
|
+
# this plugin can create conflicts with other gems.
|
113
|
+
#
|
114
|
+
# attribute_methods
|
107
115
|
end
|
108
116
|
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: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
gSQml7TqcC6dZRsZRwYqzD9kUwdAJoCqno2CBUKs2l0yQAjFT36lRrVJznb7uWwa
|
35
35
|
xpPFnsrtyaZW6Dty8TSG3qzmeGpmpIotA8x1VA==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2020-
|
37
|
+
date: 2020-12-12 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: request_store
|
@@ -247,7 +247,13 @@ metadata:
|
|
247
247
|
homepage_uri: https://github.com/shioyama/mobility
|
248
248
|
source_code_uri: https://github.com/shioyama/mobility
|
249
249
|
changelog_uri: https://github.com/shioyama/mobility/blob/master/CHANGELOG.md
|
250
|
-
post_install_message:
|
250
|
+
post_install_message: |2
|
251
|
+
|
252
|
+
Warning: Mobility v1.0 includes backwards-incompatible changes (mostly around configuration).
|
253
|
+
|
254
|
+
If you are upgrading from an earlier version, please see:
|
255
|
+
- https://github.com/shioyama/mobility/releases/tag/v1.0.0
|
256
|
+
- https://github.com/shioyama/mobility/wiki/Introduction-to-Mobility-v1.0
|
251
257
|
rdoc_options: []
|
252
258
|
require_paths:
|
253
259
|
- lib
|
@@ -258,9 +264,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
264
|
version: '2.5'
|
259
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
266
|
requirements:
|
261
|
-
- - "
|
267
|
+
- - ">="
|
262
268
|
- !ruby/object:Gem::Version
|
263
|
-
version:
|
269
|
+
version: '0'
|
264
270
|
requirements: []
|
265
271
|
rubygems_version: 3.1.2
|
266
272
|
signing_key:
|
metadata.gz.sig
CHANGED
Binary file
|