mobility 0.8.4 → 0.8.5
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +4 -4
- data/README.md +1 -1
- data/lib/mobility/backends/active_record/container.rb +34 -26
- data/lib/mobility/version.rb +1 -1
- metadata +2 -2
- 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: 9a4242439552faaeb722300168bed5974112ff0f9a66452073b9f30e4a898f08
|
4
|
+
data.tar.gz: 14d4bf01f2bed2faa7d795f809707453a44183f50516465dfeb0155bb7ce2061
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b36d734faa10f98f87283f1b4a6577c6ba10762d175383ef0ca30c3fedb7b645595b2db02d63800a1545d9ddbcc537dea0ab00b7e31b36473bf625079654bf7
|
7
|
+
data.tar.gz: 47e035ddd560973c01a64525f6206268eadfce2a38728b6195fae59cecc3822f61ccf72a824bcd14d29028fd943cf89a16d9c61c202a9e2a083cc7bc59125c71
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## 0.8
|
4
4
|
|
5
|
+
### 0.8.5 (November 1, 2018)
|
6
|
+
* Load column_type when building node
|
7
|
+
([#301](https://github.com/shioyama/mobility/pull/301))
|
8
|
+
|
5
9
|
### 0.8.4 (October 19, 2018)
|
6
10
|
* Use references to define polymorphic associations in generator migrations
|
7
11
|
([#292](https://github.com/shioyama/mobility/pull/292))
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mobility (0.
|
4
|
+
mobility (1.0.alpha.1)
|
5
5
|
i18n (>= 0.6.10, < 2)
|
6
6
|
request_store (~> 1.0)
|
7
7
|
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
guard (~> 2.1)
|
62
62
|
guard-compat (~> 1.1)
|
63
63
|
rspec (>= 2.99.0, < 4.0)
|
64
|
-
i18n (1.1.
|
64
|
+
i18n (1.1.1)
|
65
65
|
concurrent-ruby (~> 1.0)
|
66
66
|
listen (3.1.5)
|
67
67
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
minitest (5.11.3)
|
77
77
|
mysql2 (0.4.10)
|
78
78
|
nenv (0.3.0)
|
79
|
-
nokogiri (1.8.
|
79
|
+
nokogiri (1.8.5)
|
80
80
|
mini_portile2 (~> 2.3.0)
|
81
81
|
notiffany (0.1.1)
|
82
82
|
nenv (~> 0.1)
|
@@ -114,7 +114,7 @@ GEM
|
|
114
114
|
rspec-mocks (~> 3.8.0)
|
115
115
|
rspec-core (3.8.0)
|
116
116
|
rspec-support (~> 3.8.0)
|
117
|
-
rspec-expectations (3.8.
|
117
|
+
rspec-expectations (3.8.2)
|
118
118
|
diff-lcs (>= 1.2.0, < 2.0)
|
119
119
|
rspec-support (~> 3.8.0)
|
120
120
|
rspec-mocks (3.8.0)
|
data/README.md
CHANGED
@@ -17,10 +17,6 @@ Implements the {Mobility::Backends::Container} backend for ActiveRecord models.
|
|
17
17
|
# @return [Symbol] (:translations) Name of translations column
|
18
18
|
option_reader :column_name
|
19
19
|
|
20
|
-
# @!method column_type
|
21
|
-
# @return [Symbol] Either :json or :jsonb
|
22
|
-
option_reader :column_type
|
23
|
-
|
24
20
|
# @!group Backend Accessors
|
25
21
|
#
|
26
22
|
# @note Translation may be a string, integer, boolean, hash or array
|
@@ -44,30 +40,42 @@ Implements the {Mobility::Backends::Container} backend for ActiveRecord models.
|
|
44
40
|
end
|
45
41
|
# @!endgroup
|
46
42
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
options
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
43
|
+
class << self
|
44
|
+
# @!group Backend Configuration
|
45
|
+
# @option options [Symbol] column_name (:translations) Name of column on which to store translations
|
46
|
+
# @raise [InvalidColumnType] if the type of the container column is not json or jsonb
|
47
|
+
def configure(options)
|
48
|
+
options[:column_name] ||= :translations
|
49
|
+
options[:column_name] = options[:column_name].to_sym
|
50
|
+
end
|
51
|
+
# @!endgroup
|
52
|
+
|
53
|
+
# @param [String] attr Attribute name
|
54
|
+
# @param [Symbol] locale Locale
|
55
|
+
# @return [Mobility::Arel::Nodes::Json,Mobility::Arel::Nodes::Jsonb] Arel
|
56
|
+
# node for attribute on json or jsonb column
|
57
|
+
def build_node(attr, locale)
|
58
|
+
column = model_class.arel_table[column_name]
|
59
|
+
case column_type
|
60
|
+
when :json
|
61
|
+
Arel::Nodes::JsonContainer.new(column, build_quoted(locale), build_quoted(attr))
|
62
|
+
when :jsonb
|
63
|
+
Arel::Nodes::JsonbContainer.new(column, build_quoted(locale), build_quoted(attr))
|
64
|
+
end
|
56
65
|
end
|
57
|
-
end
|
58
|
-
# @!endgroup
|
59
66
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
def column_type
|
68
|
+
@column_type ||= get_column_type
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def get_column_type
|
74
|
+
options[:model_class].type_for_attribute(options[:column_name].to_s).try(:type).tap do |type|
|
75
|
+
unless %i[json jsonb].include? type
|
76
|
+
raise InvalidColumnType, "#{options[:column_name]} must be a column of type json or jsonb"
|
77
|
+
end
|
78
|
+
end
|
71
79
|
end
|
72
80
|
end
|
73
81
|
|
data/lib/mobility/version.rb
CHANGED
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: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
m46ezJjnr4uXgSNuTs+RdM6DtrKaFG2HuziSP+dzmWqZiUgj1eTACYsPwfF/Z1Z6
|
36
36
|
2DiDkec/SK4qJBMlNYPo/PTZuh5m1jROtf/hyS0VXJmm+uWc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-10-
|
38
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: request_store
|
metadata.gz.sig
CHANGED
Binary file
|