globalize 5.1.0.beta2 → 5.1.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/Gemfile.lock +60 -64
- data/README.md +9 -3
- data/lib/globalize.rb +1 -1
- data/lib/globalize/version.rb +1 -1
- data/lib/patches/active_record/rails4/serialization.rb +22 -0
- data/lib/patches/active_record/rails5_1/serialization.rb +22 -0
- data/lib/patches/active_record/serialization.rb +5 -21
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 57f25eaab88304fdb368cbbf71aba41413e20a49
|
|
4
|
+
data.tar.gz: 074e1bb69520bbf7b7dd658beaede38b8f58fcbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6793d5894ce36c34d65b8c59b0c26d12f268cfe27a0fdcba0bde632df9c0418af1c975c71ef14f56bcbcc0749b726f8d751c2e02b64e173b457e3a240527dfa7
|
|
7
|
+
data.tar.gz: b718eed39f3683df1faa47828c5535b8c50466b6fed9c15f17cd670e6597c7cbc749db725cdbeb7c711044b1a25b92d1c9042d90cfa6d71b424adbef7ffe9eec
|
data/Gemfile.lock
CHANGED
|
@@ -1,87 +1,84 @@
|
|
|
1
1
|
GIT
|
|
2
2
|
remote: https://github.com/jruby/activerecord-jdbc-adapter
|
|
3
|
-
revision:
|
|
3
|
+
revision: 4ae8a3c4d4b00d1c33ef6b9099f63a3f78da21ad
|
|
4
4
|
specs:
|
|
5
|
-
activerecord-jdbc-adapter (
|
|
6
|
-
|
|
7
|
-
activerecord-jdbcmysql-adapter (
|
|
8
|
-
activerecord-jdbc-adapter (~>
|
|
9
|
-
jdbc-mysql (
|
|
10
|
-
activerecord-jdbcpostgresql-adapter (
|
|
11
|
-
activerecord-jdbc-adapter (~>
|
|
12
|
-
jdbc-postgres (>= 9.
|
|
13
|
-
activerecord-jdbcsqlite3-adapter (
|
|
14
|
-
activerecord-jdbc-adapter (~>
|
|
15
|
-
jdbc-sqlite3 (
|
|
16
|
-
jdbc-mysql (5.1.
|
|
17
|
-
jdbc-postgres (
|
|
18
|
-
jdbc-sqlite3 (3.
|
|
5
|
+
activerecord-jdbc-adapter (51.0)
|
|
6
|
+
activerecord (~> 5.1.0)
|
|
7
|
+
activerecord-jdbcmysql-adapter (51.0)
|
|
8
|
+
activerecord-jdbc-adapter (~> 51.0)
|
|
9
|
+
jdbc-mysql (~> 5.1.36)
|
|
10
|
+
activerecord-jdbcpostgresql-adapter (51.0)
|
|
11
|
+
activerecord-jdbc-adapter (~> 51.0)
|
|
12
|
+
jdbc-postgres (>= 9.4, < 43)
|
|
13
|
+
activerecord-jdbcsqlite3-adapter (51.0)
|
|
14
|
+
activerecord-jdbc-adapter (~> 51.0)
|
|
15
|
+
jdbc-sqlite3 (~> 3.8, < 3.30)
|
|
16
|
+
jdbc-mysql (5.1.44)
|
|
17
|
+
jdbc-postgres (42.1.4)
|
|
18
|
+
jdbc-sqlite3 (3.20.1)
|
|
19
19
|
|
|
20
20
|
PATH
|
|
21
21
|
remote: .
|
|
22
22
|
specs:
|
|
23
23
|
globalize (5.1.0)
|
|
24
|
-
activemodel (>= 4.2, < 5.
|
|
25
|
-
activerecord (>= 4.2, < 5.
|
|
24
|
+
activemodel (>= 4.2, < 5.2)
|
|
25
|
+
activerecord (>= 4.2, < 5.2)
|
|
26
26
|
request_store (~> 1.0)
|
|
27
27
|
|
|
28
28
|
GEM
|
|
29
29
|
remote: https://rubygems.org/
|
|
30
30
|
specs:
|
|
31
|
-
activemodel (5.
|
|
32
|
-
activesupport (= 5.
|
|
33
|
-
activerecord (5.
|
|
34
|
-
activemodel (= 5.
|
|
35
|
-
activesupport (= 5.
|
|
36
|
-
arel (~>
|
|
37
|
-
activesupport (5.
|
|
31
|
+
activemodel (5.1.4)
|
|
32
|
+
activesupport (= 5.1.4)
|
|
33
|
+
activerecord (5.1.4)
|
|
34
|
+
activemodel (= 5.1.4)
|
|
35
|
+
activesupport (= 5.1.4)
|
|
36
|
+
arel (~> 8.0)
|
|
37
|
+
activesupport (5.1.4)
|
|
38
38
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
39
39
|
i18n (~> 0.7)
|
|
40
40
|
minitest (~> 5.1)
|
|
41
41
|
tzinfo (~> 1.1)
|
|
42
42
|
ansi (1.5.0)
|
|
43
|
-
arel (
|
|
44
|
-
builder (3.2.
|
|
45
|
-
coderay (1.1.
|
|
46
|
-
concurrent-ruby (1.0.
|
|
47
|
-
concurrent-ruby (1.0.
|
|
48
|
-
database_cleaner (1.
|
|
49
|
-
ffi (1.9.
|
|
43
|
+
arel (8.0.0)
|
|
44
|
+
builder (3.2.3)
|
|
45
|
+
coderay (1.1.2)
|
|
46
|
+
concurrent-ruby (1.0.5)
|
|
47
|
+
concurrent-ruby (1.0.5-java)
|
|
48
|
+
database_cleaner (1.6.2)
|
|
49
|
+
ffi (1.9.18-java)
|
|
50
50
|
ffi2-generators (0.1.1)
|
|
51
|
-
i18n (0.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
minitest (5.9.0)
|
|
57
|
-
minitest-reporters (1.1.10)
|
|
51
|
+
i18n (0.9.1)
|
|
52
|
+
concurrent-ruby (~> 1.0)
|
|
53
|
+
method_source (0.9.0)
|
|
54
|
+
minitest (5.11.1)
|
|
55
|
+
minitest-reporters (1.1.19)
|
|
58
56
|
ansi
|
|
59
57
|
builder
|
|
60
58
|
minitest (>= 5.0)
|
|
61
59
|
ruby-progressbar
|
|
62
|
-
mysql2 (0.4.
|
|
63
|
-
pg (0.
|
|
64
|
-
pry (0.
|
|
60
|
+
mysql2 (0.4.10)
|
|
61
|
+
pg (1.0.0)
|
|
62
|
+
pry (0.11.3)
|
|
65
63
|
coderay (~> 1.1.0)
|
|
66
|
-
method_source (~> 0.
|
|
67
|
-
|
|
68
|
-
pry (0.10.4-java)
|
|
64
|
+
method_source (~> 0.9.0)
|
|
65
|
+
pry (0.11.3-java)
|
|
69
66
|
coderay (~> 1.1.0)
|
|
70
|
-
method_source (~> 0.
|
|
71
|
-
slop (~> 3.4)
|
|
67
|
+
method_source (~> 0.9.0)
|
|
72
68
|
spoon (~> 0.0)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
request_store (1.
|
|
69
|
+
rack (2.0.3)
|
|
70
|
+
rake (12.3.0)
|
|
71
|
+
rdoc (6.0.1)
|
|
72
|
+
request_store (1.4.0)
|
|
73
|
+
rack (>= 1.4)
|
|
77
74
|
rubinius-coverage (2.1)
|
|
78
|
-
rubinius-debugger (2.
|
|
75
|
+
rubinius-debugger (2.6)
|
|
79
76
|
rubinius-developer_tools (2.0.0)
|
|
80
77
|
rubinius-coverage (~> 2.0)
|
|
81
78
|
rubinius-debugger (~> 2.0)
|
|
82
79
|
rubinius-profiler (~> 2.0)
|
|
83
80
|
rubinius-profiler (2.1)
|
|
84
|
-
ruby-progressbar (1.
|
|
81
|
+
ruby-progressbar (1.9.0)
|
|
85
82
|
rubysl (2.2.0)
|
|
86
83
|
rubysl-abbrev (~> 2.0)
|
|
87
84
|
rubysl-base64 (~> 2.0)
|
|
@@ -223,7 +220,7 @@ GEM
|
|
|
223
220
|
rubysl-mkmf (2.1)
|
|
224
221
|
rubysl-fileutils (~> 2.0)
|
|
225
222
|
rubysl-shellwords (~> 2.0)
|
|
226
|
-
rubysl-monitor (2.
|
|
223
|
+
rubysl-monitor (2.1)
|
|
227
224
|
rubysl-mutex_m (2.0.0)
|
|
228
225
|
rubysl-net-ftp (2.0.1)
|
|
229
226
|
rubysl-net-http (2.0.4)
|
|
@@ -239,7 +236,7 @@ GEM
|
|
|
239
236
|
rubysl-observer (2.0.0)
|
|
240
237
|
rubysl-open-uri (2.0.0)
|
|
241
238
|
rubysl-open3 (2.0.0)
|
|
242
|
-
rubysl-openssl (2.
|
|
239
|
+
rubysl-openssl (2.9)
|
|
243
240
|
rubysl-optparse (2.0.1)
|
|
244
241
|
rubysl-shellwords (~> 2.0)
|
|
245
242
|
rubysl-ostruct (2.1.0)
|
|
@@ -260,15 +257,15 @@ GEM
|
|
|
260
257
|
rubysl-set (2.0.1)
|
|
261
258
|
rubysl-shellwords (2.0.0)
|
|
262
259
|
rubysl-singleton (2.0.0)
|
|
263
|
-
rubysl-socket (2.1
|
|
260
|
+
rubysl-socket (2.2.1)
|
|
264
261
|
rubysl-fcntl (~> 2.0)
|
|
265
|
-
rubysl-stringio (2.
|
|
262
|
+
rubysl-stringio (2.2)
|
|
266
263
|
rubysl-strscan (2.0.0)
|
|
267
264
|
rubysl-sync (2.0.0)
|
|
268
265
|
rubysl-syslog (2.1.0)
|
|
269
266
|
ffi2-generators (~> 0.1)
|
|
270
267
|
rubysl-tempfile (2.0.1)
|
|
271
|
-
rubysl-thread (2.
|
|
268
|
+
rubysl-thread (2.1)
|
|
272
269
|
rubysl-thwait (2.0.0)
|
|
273
270
|
rubysl-time (2.0.3)
|
|
274
271
|
rubysl-timeout (2.0.0)
|
|
@@ -284,13 +281,12 @@ GEM
|
|
|
284
281
|
rubysl-xmlrpc (2.0.0)
|
|
285
282
|
rubysl-yaml (2.1.0)
|
|
286
283
|
rubysl-zlib (2.0.1)
|
|
287
|
-
|
|
288
|
-
spoon (0.0.4)
|
|
284
|
+
spoon (0.0.6)
|
|
289
285
|
ffi
|
|
290
|
-
sqlite3 (1.3.
|
|
291
|
-
thread_safe (0.3.
|
|
292
|
-
thread_safe (0.3.
|
|
293
|
-
tzinfo (1.2.
|
|
286
|
+
sqlite3 (1.3.13)
|
|
287
|
+
thread_safe (0.3.6)
|
|
288
|
+
thread_safe (0.3.6-java)
|
|
289
|
+
tzinfo (1.2.4)
|
|
294
290
|
thread_safe (~> 0.1)
|
|
295
291
|
|
|
296
292
|
PLATFORMS
|
|
@@ -315,4 +311,4 @@ DEPENDENCIES
|
|
|
315
311
|
sqlite3
|
|
316
312
|
|
|
317
313
|
BUNDLED WITH
|
|
318
|
-
1.
|
|
314
|
+
1.16.1
|
data/README.md
CHANGED
|
@@ -30,7 +30,13 @@ When using bundler put this in your Gemfile:
|
|
|
30
30
|
gem 'globalize', '~> 5.0.0'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
You have to use
|
|
33
|
+
You have to use the **master** branch to work with Rails 5, or you can use a pre-release gem:
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
gem 'globalize', '~> 5.1.0.beta2'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Please help us by letting us know what works, and what doesn't, when using pre-release code.
|
|
34
40
|
|
|
35
41
|
Put in your Gemfile
|
|
36
42
|
|
|
@@ -250,9 +256,9 @@ If you like your translated model to update if a translation changes, use the `t
|
|
|
250
256
|
If you're getting the `ActiveRecord::StatementInvalid: PG::NotNullViolation: ERROR: null value in column "column_name" violates not-null constraint` error, the only known way to deal with it as of now is to remove not-null constraint for the globalized columns:
|
|
251
257
|
|
|
252
258
|
```ruby
|
|
253
|
-
class
|
|
259
|
+
class RemoveNullConstraintsFromResourceTranslations < ActiveRecord::Migration
|
|
254
260
|
def change
|
|
255
|
-
change_column_null :
|
|
261
|
+
change_column_null :resource_translations, :column_name, true
|
|
256
262
|
end
|
|
257
263
|
end
|
|
258
264
|
```
|
data/lib/globalize.rb
CHANGED
|
@@ -84,7 +84,7 @@ module Globalize
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
ActiveRecord::Base.
|
|
87
|
+
ActiveRecord::Base.class_attribute :globalize_serialized_attributes, instance_writer: false
|
|
88
88
|
ActiveRecord::Base.globalize_serialized_attributes = {}
|
|
89
89
|
|
|
90
90
|
ActiveRecord::Base.extend(Globalize::ActiveRecord::ActMacro)
|
data/lib/globalize/version.rb
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Globalize
|
|
2
|
+
module AttributeMethods
|
|
3
|
+
module Serialization
|
|
4
|
+
def serialize(attr_name, class_name_or_coder = Object)
|
|
5
|
+
super(attr_name, class_name_or_coder)
|
|
6
|
+
|
|
7
|
+
coder = if class_name_or_coder == ::JSON
|
|
8
|
+
::ActiveRecord::Coders::JSON
|
|
9
|
+
elsif [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) }
|
|
10
|
+
class_name_or_coder
|
|
11
|
+
else
|
|
12
|
+
::ActiveRecord::Coders::YAMLColumn.new(class_name_or_coder)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
self.globalize_serialized_attributes = globalize_serialized_attributes.dup
|
|
16
|
+
self.globalize_serialized_attributes[attr_name] = coder
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
ActiveRecord::AttributeMethods::Serialization::ClassMethods.send(:prepend, Globalize::AttributeMethods::Serialization)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Globalize
|
|
2
|
+
module AttributeMethods
|
|
3
|
+
module Serialization
|
|
4
|
+
def serialize(attr_name, class_name_or_coder = Object)
|
|
5
|
+
super(attr_name, class_name_or_coder)
|
|
6
|
+
|
|
7
|
+
coder = if class_name_or_coder == ::JSON
|
|
8
|
+
::ActiveRecord::Coders::JSON
|
|
9
|
+
elsif [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) }
|
|
10
|
+
class_name_or_coder
|
|
11
|
+
else
|
|
12
|
+
::ActiveRecord::Coders::YAMLColumn.new(attr_name, class_name_or_coder)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
self.globalize_serialized_attributes = globalize_serialized_attributes.dup
|
|
16
|
+
self.globalize_serialized_attributes[attr_name] = coder
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
ActiveRecord::AttributeMethods::Serialization::ClassMethods.send(:prepend, Globalize::AttributeMethods::Serialization)
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
coder = if class_name_or_coder == ::JSON
|
|
8
|
-
::ActiveRecord::Coders::JSON
|
|
9
|
-
elsif [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) }
|
|
10
|
-
class_name_or_coder
|
|
11
|
-
else
|
|
12
|
-
::ActiveRecord::Coders::YAMLColumn.new(class_name_or_coder)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
self.globalize_serialized_attributes[attr_name] = coder
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
ActiveRecord::AttributeMethods::Serialization::ClassMethods.send(:prepend, Globalize::AttributeMethods::Serialization)
|
|
1
|
+
if ::ActiveRecord::VERSION::STRING < "5.1.0"
|
|
2
|
+
require_relative 'rails4/serialization'
|
|
3
|
+
else
|
|
4
|
+
require_relative 'rails5_1/serialization'
|
|
5
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: globalize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.1.0
|
|
4
|
+
version: 5.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Fuchs
|
|
@@ -14,7 +14,7 @@ authors:
|
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
|
-
date:
|
|
17
|
+
date: 2018-01-15 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: activerecord
|
|
@@ -172,8 +172,10 @@ files:
|
|
|
172
172
|
- lib/patches/active_record/persistence.rb
|
|
173
173
|
- lib/patches/active_record/query_method.rb
|
|
174
174
|
- lib/patches/active_record/rails4/query_method.rb
|
|
175
|
+
- lib/patches/active_record/rails4/serialization.rb
|
|
175
176
|
- lib/patches/active_record/rails4/uniqueness_validator.rb
|
|
176
177
|
- lib/patches/active_record/rails5/uniqueness_validator.rb
|
|
178
|
+
- lib/patches/active_record/rails5_1/serialization.rb
|
|
177
179
|
- lib/patches/active_record/rails5_1/uniqueness_validator.rb
|
|
178
180
|
- lib/patches/active_record/relation.rb
|
|
179
181
|
- lib/patches/active_record/serialization.rb
|
|
@@ -194,12 +196,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
194
196
|
version: 2.0.0
|
|
195
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
198
|
requirements:
|
|
197
|
-
- - "
|
|
199
|
+
- - ">="
|
|
198
200
|
- !ruby/object:Gem::Version
|
|
199
|
-
version:
|
|
201
|
+
version: '0'
|
|
200
202
|
requirements: []
|
|
201
203
|
rubyforge_project: "[none]"
|
|
202
|
-
rubygems_version: 2.6.
|
|
204
|
+
rubygems_version: 2.6.13
|
|
203
205
|
signing_key:
|
|
204
206
|
specification_version: 4
|
|
205
207
|
summary: Rails I18n de-facto standard library for ActiveRecord model/data translation
|