mobility 1.2.0 → 1.2.4
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/CHANGELOG.md +25 -9
- data/Gemfile.lock +29 -10
- data/README.md +1 -1
- data/lib/mobility/backend.rb +6 -0
- data/lib/mobility/backends/sequel/container.rb +1 -1
- data/lib/mobility/plugins/active_record/column_fallback.rb +28 -101
- data/lib/mobility/plugins/backend.rb +22 -4
- data/lib/mobility/plugins/fallbacks.rb +23 -29
- data/lib/mobility/plugins/sequel/column_fallback.rb +26 -93
- data/lib/mobility/version.rb +1 -1
- data.tar.gz.sig +0 -0
- 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: d0dd974f8a077b31fc0ab41df158e4cac50c6aee4e7fd66348db1ed2ef5f78f9
|
4
|
+
data.tar.gz: ea72521a4bb8daedf08d3012353c591ec47f76e3fe6ec3c10b87e331a5404db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b9df45774c9b3d4ae343b2f083b2a85ddfd7585283998b0dc624aa62eee5c6e5fade0737ae78b3dd728dd273a03dcf10afecabcca6eb8f90400619de0a7fa4
|
7
|
+
data.tar.gz: 1f199821139bf35b4e176f52dac0249f482ffb5edc9d7957d437e9262a908812fab01ba5dea52e18a9b1f37f92744b345c34ca0c84d97da0641f9fab19577704
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,22 +1,38 @@
|
|
1
1
|
# Mobility Changelog
|
2
2
|
|
3
|
-
##
|
4
|
-
- Assign blank values in pg hash backends
|
5
|
-
([#516](https://github.com/shioyama/mobility/pull/516))
|
3
|
+
## 1.2
|
6
4
|
|
7
|
-
|
5
|
+
### 1.2.4
|
6
|
+
- Fix fallbacks performance regression
|
7
|
+
([#548](https://github.com/shioyama/mobility/pull/548))
|
8
8
|
|
9
|
-
|
9
|
+
### 1.2.3
|
10
|
+
- Fix passing wrong options to super in fallbacks plugin
|
11
|
+
([#539](https://github.com/shioyama/mobility/pull/539))
|
12
|
+
|
13
|
+
### 1.2.2
|
14
|
+
- Make models work with `Marshal.dump`
|
15
|
+
([#532](https://github.com/shioyama/mobility/pull/532))
|
16
|
+
- Fix Sequel container op in Sequel
|
17
|
+
([#533](https://github.com/shioyama/mobility/pull/533))
|
18
|
+
- Simplify Fallbacks plugin
|
19
|
+
([#531](https://github.com/shioyama/mobility/pull/531))
|
20
|
+
|
21
|
+
### 1.2.1
|
22
|
+
- Refactor ColumnFallback plugin
|
23
|
+
([#530](https://github.com/shioyama/mobility/pull/530))
|
10
24
|
|
11
25
|
### 1.2.0
|
12
26
|
- Add ColumnFallback plugin
|
13
|
-
|
27
|
+
([#512](https://github.com/shioyama/mobility/pull/512))
|
14
28
|
- Fix Sequel querying on untranslated attributes in `i18n` block
|
15
|
-
|
29
|
+
([#529](https://github.com/shioyama/mobility/pull/529))
|
16
30
|
- Allow passing configured backend class as third argument to setup
|
17
|
-
|
31
|
+
([#528](https://github.com/shioyama/mobility/pull/528))
|
18
32
|
- Clearly distinguish backend classes from their configured subclasses
|
19
|
-
|
33
|
+
([#527](https://github.com/shioyama/mobility/pull/527))
|
34
|
+
|
35
|
+
## 1.1
|
20
36
|
|
21
37
|
### 1.1.3
|
22
38
|
- Do not swallow keyword args on ruby 3 in fallthrough accessors
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,44 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/rails/rails.git
|
3
|
+
revision: 5647a9c1ced68d20338552d47a3b755e10a271c4
|
4
|
+
branch: main
|
5
|
+
specs:
|
6
|
+
activemodel (7.0.0.alpha2)
|
7
|
+
activesupport (= 7.0.0.alpha2)
|
8
|
+
activerecord (7.0.0.alpha2)
|
9
|
+
activemodel (= 7.0.0.alpha2)
|
10
|
+
activesupport (= 7.0.0.alpha2)
|
11
|
+
activesupport (7.0.0.alpha2)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
|
1
17
|
PATH
|
2
18
|
remote: .
|
3
19
|
specs:
|
4
|
-
mobility (1.
|
20
|
+
mobility (1.3.0.alpha)
|
5
21
|
i18n (>= 0.6.10, < 2)
|
6
22
|
request_store (~> 1.0)
|
7
23
|
|
8
24
|
GEM
|
9
25
|
remote: https://rubygems.org/
|
10
26
|
specs:
|
11
|
-
benchmark-ips (2.
|
27
|
+
benchmark-ips (2.9.1)
|
12
28
|
byebug (11.1.3)
|
13
29
|
coderay (1.1.3)
|
14
30
|
concurrent-ruby (1.1.9)
|
15
31
|
database_cleaner (1.99.0)
|
16
32
|
diff-lcs (1.4.4)
|
17
|
-
ffi (1.15.
|
18
|
-
formatador (0.
|
19
|
-
guard (2.
|
33
|
+
ffi (1.15.4)
|
34
|
+
formatador (0.3.0)
|
35
|
+
guard (2.18.0)
|
20
36
|
formatador (>= 0.2.4)
|
21
37
|
listen (>= 2.7, < 4.0)
|
22
38
|
lumberjack (>= 1.0.12, < 2.0)
|
23
39
|
nenv (~> 0.1)
|
24
40
|
notiffany (~> 0.0)
|
25
|
-
pry (>= 0.
|
41
|
+
pry (>= 0.13.0)
|
26
42
|
shellany (~> 0.0)
|
27
43
|
thor (>= 0.18.1)
|
28
44
|
guard-compat (1.2.1)
|
@@ -32,11 +48,12 @@ GEM
|
|
32
48
|
rspec (>= 2.99.0, < 4.0)
|
33
49
|
i18n (1.8.10)
|
34
50
|
concurrent-ruby (~> 1.0)
|
35
|
-
listen (3.
|
51
|
+
listen (3.7.0)
|
36
52
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
37
53
|
rb-inotify (~> 0.9, >= 0.9.10)
|
38
54
|
lumberjack (1.2.8)
|
39
55
|
method_source (1.0.0)
|
56
|
+
minitest (5.14.4)
|
40
57
|
nenv (0.3.0)
|
41
58
|
notiffany (0.1.3)
|
42
59
|
nenv (~> 0.1)
|
@@ -50,7 +67,7 @@ GEM
|
|
50
67
|
pry (~> 0.13.0)
|
51
68
|
rack (2.2.3)
|
52
69
|
rake (12.3.3)
|
53
|
-
rb-fsevent (0.
|
70
|
+
rb-fsevent (0.11.0)
|
54
71
|
rb-inotify (0.10.1)
|
55
72
|
ffi (~> 1.0)
|
56
73
|
request_store (1.5.0)
|
@@ -68,15 +85,18 @@ GEM
|
|
68
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
69
86
|
rspec-support (~> 3.10.0)
|
70
87
|
rspec-support (3.10.2)
|
71
|
-
sequel (5.48.0)
|
72
88
|
shellany (0.0.1)
|
73
89
|
thor (1.1.0)
|
90
|
+
tzinfo (2.0.4)
|
91
|
+
concurrent-ruby (~> 1.0)
|
74
92
|
yard (0.9.26)
|
75
93
|
|
76
94
|
PLATFORMS
|
77
95
|
ruby
|
78
96
|
|
79
97
|
DEPENDENCIES
|
98
|
+
activerecord!
|
99
|
+
activesupport!
|
80
100
|
benchmark-ips
|
81
101
|
database_cleaner (~> 1.5, >= 1.5.3)
|
82
102
|
guard-rspec
|
@@ -85,7 +105,6 @@ DEPENDENCIES
|
|
85
105
|
pry-byebug
|
86
106
|
rake (~> 12, >= 12.2.1)
|
87
107
|
rspec (~> 3.0)
|
88
|
-
sequel (~> 5.0)
|
89
108
|
yard (~> 0.9.0)
|
90
109
|
|
91
110
|
BUNDLED WITH
|
data/README.md
CHANGED
data/lib/mobility/backend.rb
CHANGED
@@ -77,6 +77,12 @@ On top of this, a backend will normally:
|
|
77
77
|
@attribute = args[1]
|
78
78
|
end
|
79
79
|
|
80
|
+
def ==(backend)
|
81
|
+
backend.class == self.class &&
|
82
|
+
backend.attribute == attribute &&
|
83
|
+
backend.model == model
|
84
|
+
end
|
85
|
+
|
80
86
|
# @!macro [new] backend_reader
|
81
87
|
# Gets the translated value for provided locale from configured backend.
|
82
88
|
# @param [Symbol] locale Locale to read
|
@@ -100,7 +100,7 @@ Implements the {Mobility::Backends::Container} backend for Sequel models.
|
|
100
100
|
# @return [Mobility::Backends::Sequel::Container::JSONOp,Mobility::Backends::Sequel::Container::JSONBOp]
|
101
101
|
def self.build_op(attr, locale)
|
102
102
|
klass = const_get("#{options[:column_type].upcase}Op")
|
103
|
-
klass.new(klass.new(column_name.to_sym)
|
103
|
+
klass.new(klass.new(column_name.to_sym).get(locale.to_s)).get_text(attr)
|
104
104
|
end
|
105
105
|
|
106
106
|
class JSONOp < ::Sequel::Postgres::JSONOp; end
|
@@ -14,120 +14,47 @@ Plugin to use an original column for a given locale, and otherwise use the backe
|
|
14
14
|
requires :column_fallback, include: false
|
15
15
|
|
16
16
|
included_hook do |_, backend_class|
|
17
|
-
|
17
|
+
backend_class.include BackendInstanceMethods
|
18
|
+
backend_class.extend BackendClassMethods
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.use_column_fallback?(options, locale)
|
22
|
+
case column_fallback = options[:column_fallback]
|
18
23
|
when TrueClass
|
19
|
-
|
20
|
-
when Array
|
21
|
-
|
24
|
+
locale == I18n.default_locale
|
25
|
+
when Array
|
26
|
+
column_fallback.include?(locale)
|
27
|
+
when Proc
|
28
|
+
column_fallback.call(locale)
|
22
29
|
else
|
23
|
-
|
30
|
+
false
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
27
|
-
module
|
34
|
+
module BackendInstanceMethods
|
28
35
|
def read(locale, **)
|
29
|
-
|
36
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
37
|
+
model.read_attribute(attribute)
|
38
|
+
else
|
39
|
+
super
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
43
|
def write(locale, value, **)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
base.extend(ClassMethods)
|
38
|
-
end
|
39
|
-
|
40
|
-
module ClassMethods
|
41
|
-
def build_node(attr, locale)
|
42
|
-
if locale == I18n.default_locale
|
43
|
-
model_class.arel_table[attr]
|
44
|
-
else
|
45
|
-
super
|
46
|
-
end
|
44
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
45
|
+
model.send(:write_attribute, attribute, value)
|
46
|
+
else
|
47
|
+
super
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
define_proc_accessors
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def included(base)
|
62
|
-
base.extend(ClassMethods.new(@column_fallback))
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def define_array_accessors
|
68
|
-
column_fallback = @column_fallback
|
69
|
-
|
70
|
-
module_eval <<-EOM, __FILE__, __LINE__ + 1
|
71
|
-
def read(locale, **)
|
72
|
-
if #{column_fallback}.include?(locale)
|
73
|
-
model.read_attribute(attribute)
|
74
|
-
else
|
75
|
-
super
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def write(locale, value, **)
|
80
|
-
if #{column_fallback}.include?(locale)
|
81
|
-
model.send(:write_attribute, attribute, value)
|
82
|
-
else
|
83
|
-
super
|
84
|
-
end
|
85
|
-
end
|
86
|
-
EOM
|
87
|
-
end
|
88
|
-
|
89
|
-
def define_proc_accessors
|
90
|
-
column_fallback = @column_fallback
|
91
|
-
|
92
|
-
define_method :read do |locale, **options|
|
93
|
-
if column_fallback.call(locale)
|
94
|
-
model.read_attribute(attribute)
|
95
|
-
else
|
96
|
-
super(locale, **options)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
define_method :write do |locale, value, **options|
|
101
|
-
if column_fallback.call(locale)
|
102
|
-
model.send(:write_attribute, attribute, value)
|
103
|
-
else
|
104
|
-
super(locale, value, **options)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
class ClassMethods < Module
|
110
|
-
def initialize(column_fallback)
|
111
|
-
case column_fallback
|
112
|
-
when Array
|
113
|
-
module_eval <<-EOM, __FILE__, __LINE__ + 1
|
114
|
-
def build_node(attr, locale)
|
115
|
-
if #{column_fallback}.include?(locale)
|
116
|
-
model_class.arel_table[attr]
|
117
|
-
else
|
118
|
-
super
|
119
|
-
end
|
120
|
-
end
|
121
|
-
EOM
|
122
|
-
when Proc
|
123
|
-
define_method(:build_node) do |attr, locale|
|
124
|
-
if column_fallback.call(locale)
|
125
|
-
model_class.arel_table[attr]
|
126
|
-
else
|
127
|
-
super(attr, locale)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
52
|
+
module BackendClassMethods
|
53
|
+
def build_node(attr, locale)
|
54
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
55
|
+
model_class.arel_table[attr]
|
56
|
+
else
|
57
|
+
super
|
131
58
|
end
|
132
59
|
end
|
133
60
|
end
|
@@ -114,15 +114,33 @@ Defines:
|
|
114
114
|
defaults[key] = [backend, backend_options] if backend
|
115
115
|
end
|
116
116
|
|
117
|
+
class MobilityBackends < Hash
|
118
|
+
def initialize(model)
|
119
|
+
@model = model
|
120
|
+
super()
|
121
|
+
end
|
122
|
+
|
123
|
+
def [](name)
|
124
|
+
return fetch(name) if has_key?(name)
|
125
|
+
return self[name.to_sym] if String === name
|
126
|
+
self[name] = @model.class.mobility_backend_class(name).new(@model, name.to_s)
|
127
|
+
end
|
128
|
+
|
129
|
+
def marshal_dump
|
130
|
+
@model
|
131
|
+
end
|
132
|
+
|
133
|
+
def marshal_load(model)
|
134
|
+
@model = model
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
117
138
|
module InstanceMethods
|
118
139
|
# Return a new backend for an attribute name.
|
119
140
|
# @return [Hash] Hash of attribute names and backend instances
|
120
141
|
# @api private
|
121
142
|
def mobility_backends
|
122
|
-
@mobility_backends ||=
|
123
|
-
next hash[name.to_sym] if String === name
|
124
|
-
hash[name] = self.class.mobility_backend_class(name).new(self, name.to_s)
|
125
|
-
end
|
143
|
+
@mobility_backends ||= MobilityBackends.new(self)
|
126
144
|
end
|
127
145
|
|
128
146
|
def initialize_dup(other)
|
@@ -117,8 +117,21 @@ the current locale was +nil+.
|
|
117
117
|
# Applies fallbacks plugin to attributes. Completely disables fallbacks
|
118
118
|
# on model if option is +false+.
|
119
119
|
included_hook do |_, backend_class|
|
120
|
-
|
121
|
-
|
120
|
+
unless options[:fallbacks] == false
|
121
|
+
backend_class.include(BackendInstanceMethods)
|
122
|
+
|
123
|
+
fallbacks =
|
124
|
+
if options[:fallbacks].is_a?(Hash)
|
125
|
+
generate_fallbacks(options[:fallbacks])
|
126
|
+
elsif options[:fallbacks] == true
|
127
|
+
generate_fallbacks({})
|
128
|
+
else
|
129
|
+
::Hash.new { [] }
|
130
|
+
end
|
131
|
+
|
132
|
+
backend_class.singleton_class.attr_reader :fallbacks
|
133
|
+
backend_class.instance_variable_set(:@fallbacks, fallbacks)
|
134
|
+
end
|
122
135
|
end
|
123
136
|
|
124
137
|
private
|
@@ -134,36 +147,17 @@ the current locale was +nil+.
|
|
134
147
|
end
|
135
148
|
end
|
136
149
|
|
137
|
-
|
138
|
-
def
|
139
|
-
|
140
|
-
define_read(convert_option_to_fallbacks(fallbacks_option))
|
141
|
-
end
|
142
|
-
|
143
|
-
private
|
150
|
+
module BackendInstanceMethods
|
151
|
+
def read(locale, fallback: true, **kwargs)
|
152
|
+
return super(locale, **kwargs) if !fallback || kwargs[:locale]
|
144
153
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
locales = fallback == true ? fallbacks[locale] : [locale, *fallback]
|
150
|
-
locales.each do |fallback_locale|
|
151
|
-
value = super(fallback_locale, **options)
|
152
|
-
return value if Util.present?(value)
|
153
|
-
end
|
154
|
-
|
155
|
-
super(locale, **options)
|
154
|
+
locales = fallback == true ? self.class.fallbacks[locale] : [locale, *fallback]
|
155
|
+
locales.each do |fallback_locale|
|
156
|
+
value = super(fallback_locale, **kwargs)
|
157
|
+
return value if Util.present?(value)
|
156
158
|
end
|
157
|
-
end
|
158
159
|
|
159
|
-
|
160
|
-
if option.is_a?(::Hash)
|
161
|
-
@fallbacks_generator[option]
|
162
|
-
elsif option == true
|
163
|
-
@fallbacks_generator[{}]
|
164
|
-
else
|
165
|
-
::Hash.new { [] }
|
166
|
-
end
|
160
|
+
super(locale, **kwargs)
|
167
161
|
end
|
168
162
|
end
|
169
163
|
end
|
@@ -14,114 +14,47 @@ Plugin to use an original column for a given locale, and otherwise use the backe
|
|
14
14
|
requires :column_fallback, include: false
|
15
15
|
|
16
16
|
included_hook do |_, backend_class|
|
17
|
-
|
17
|
+
backend_class.include BackendInstanceMethods
|
18
|
+
backend_class.extend BackendClassMethods
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.use_column_fallback?(options, locale)
|
22
|
+
case column_fallback = options[:column_fallback]
|
18
23
|
when TrueClass
|
19
|
-
|
20
|
-
when Array
|
21
|
-
|
24
|
+
locale == I18n.default_locale
|
25
|
+
when Array
|
26
|
+
column_fallback.include?(locale)
|
27
|
+
when Proc
|
28
|
+
column_fallback.call(locale)
|
29
|
+
else
|
30
|
+
false
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
25
|
-
module
|
34
|
+
module BackendInstanceMethods
|
26
35
|
def read(locale, **)
|
27
|
-
|
36
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
37
|
+
model[attribute.to_sym]
|
38
|
+
else
|
39
|
+
super
|
40
|
+
end
|
28
41
|
end
|
29
42
|
|
30
43
|
def write(locale, value, **)
|
31
|
-
if locale
|
44
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
32
45
|
model[attribute.to_sym] = value
|
33
46
|
else
|
34
47
|
super
|
35
48
|
end
|
36
49
|
end
|
37
|
-
|
38
|
-
def self.included(base)
|
39
|
-
base.extend(ClassMethods)
|
40
|
-
end
|
41
|
-
|
42
|
-
module ClassMethods
|
43
|
-
def build_op(attr, locale)
|
44
|
-
if locale == I18n.default_locale
|
45
|
-
::Sequel::SQL::QualifiedIdentifier.new(model_class.table_name, attr.to_sym)
|
46
|
-
else
|
47
|
-
super
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
50
|
end
|
52
51
|
|
53
|
-
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
define_proc_accessors
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def included(base)
|
64
|
-
base.extend(ClassMethods.new(@column_fallback))
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def define_array_accessors
|
70
|
-
column_fallback = @column_fallback
|
71
|
-
|
72
|
-
module_eval <<-EOM, __FILE__, __LINE__ + 1
|
73
|
-
def read(locale, **)
|
74
|
-
#{column_fallback}.include?(locale) ? model[attribute.to_sym] : super
|
75
|
-
end
|
76
|
-
|
77
|
-
def write(locale, value, **)
|
78
|
-
if #{column_fallback}.include?(locale)
|
79
|
-
model[attribute.to_sym] = value
|
80
|
-
else
|
81
|
-
super
|
82
|
-
end
|
83
|
-
end
|
84
|
-
EOM
|
85
|
-
end
|
86
|
-
|
87
|
-
def define_proc_accessors
|
88
|
-
column_fallback = @column_fallback
|
89
|
-
|
90
|
-
define_method :read do |locale, **options|
|
91
|
-
column_fallback.call(locale) ? model[attribute.to_sym] : super(locale, **options)
|
92
|
-
end
|
93
|
-
|
94
|
-
define_method :write do |locale, value, **options|
|
95
|
-
if column_fallback.call(locale)
|
96
|
-
model[attribute.to_sym] = value
|
97
|
-
else
|
98
|
-
super(locale, value, **options)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
class ClassMethods < Module
|
104
|
-
def initialize(column_fallback)
|
105
|
-
case column_fallback
|
106
|
-
when Array
|
107
|
-
module_eval <<-EOM, __FILE__, __LINE__ + 1
|
108
|
-
def build_op(attr, locale)
|
109
|
-
if #{column_fallback}.include?(locale)
|
110
|
-
::Sequel::SQL::QualifiedIdentifier.new(model_class.table_name, attr.to_sym)
|
111
|
-
else
|
112
|
-
super
|
113
|
-
end
|
114
|
-
end
|
115
|
-
EOM
|
116
|
-
when Proc
|
117
|
-
define_method(:build_op) do |attr, locale|
|
118
|
-
if column_fallback.call(locale)
|
119
|
-
::Sequel::SQL::QualifiedIdentifier.new(model_class.table_name, attr.to_sym)
|
120
|
-
else
|
121
|
-
super(attr, locale)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
52
|
+
module BackendClassMethods
|
53
|
+
def build_op(attr, locale)
|
54
|
+
if ColumnFallback.use_column_fallback?(options, locale)
|
55
|
+
::Sequel::SQL::QualifiedIdentifier.new(model_class.table_name, attr.to_sym)
|
56
|
+
else
|
57
|
+
super
|
125
58
|
end
|
126
59
|
end
|
127
60
|
end
|
data/lib/mobility/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
eBMcZq0d1tbtv1M1UXND9mOfhLZ31YvoSTPkrJiRpljUNgD0+ugelnr1/5X/9k8y
|
35
35
|
J9QOd3C5jpSShf/HMvpJnFuSYFm19cH9GrHjvw==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2021-
|
37
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: request_store
|
metadata.gz.sig
CHANGED
Binary file
|