mobility 0.3.0 → 0.3.1
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 +18 -19
- data/README.md +2 -1
- data/lib/mobility/plugins/active_record/dirty.rb +20 -13
- 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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7758652b17c028026785aab433d317fa8508b3b1
|
4
|
+
data.tar.gz: 359c5dd578fe9f7d2f1cb3aef187aacbf3a12246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42dc9e922f1da3baccad99b8acaff68b7ff7f69623b700ba71b698337c2d21dd78ec53b07d533d7c3cfb732d4f44b999506e31103ab2027e591146ddb65556be
|
7
|
+
data.tar.gz: ce8545687458395b0817ef6f478262664478afcc6a3b9d22441d1eae61268f8d705deacef2ba30f01e2573bafc688f4d51d813cf62bfe444bf5bce3cfb93c9c7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
## 0.3
|
4
4
|
|
5
|
+
### 0.3.1 (December 1, 2017)
|
6
|
+
* Disable AR::Dirty method overrides for AR >= 5.2 (and < 5.1 for `has_attribute`) ([#120](https://github.com/shioyama/mobility/pull/120))
|
7
|
+
|
5
8
|
### 0.3.0 (November 30, 2017)
|
6
9
|
* `dup` support for table backend ([#84](https://github.com/shioyama/mobility/pull/84)). Thanks [@pwim](https://github.com/pwim)!
|
7
10
|
* Disable fallbacks when using locale/fallthrough accessors
|
@@ -15,6 +18,7 @@
|
|
15
18
|
* Update dependency versions ([#107](https://github.com/shioyama/mobility/pull/107))
|
16
19
|
* Support new AR::Dirty methods ([#111](https://github.com/shioyama/mobility/pull/111))
|
17
20
|
* Use `public_send` in LocaleAccessors plugin ([#117](https://github.com/shioyama/mobility/pull/117))
|
21
|
+
* Deprecate setting value of `default_options` directly ([#113](https://github.com/shioyama/mobility/pull/113))
|
18
22
|
|
19
23
|
## 0.2
|
20
24
|
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mobility (0.3.0
|
4
|
+
mobility (0.3.0)
|
5
5
|
i18n (>= 0.6.10, < 0.10)
|
6
6
|
request_store (~> 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (5.
|
12
|
-
actionview (= 5.
|
13
|
-
activesupport (= 5.
|
11
|
+
actionpack (5.1.4)
|
12
|
+
actionview (= 5.1.4)
|
13
|
+
activesupport (= 5.1.4)
|
14
14
|
rack (~> 2.0)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
-
actionview (5.
|
19
|
-
activesupport (= 5.
|
18
|
+
actionview (5.1.4)
|
19
|
+
activesupport (= 5.1.4)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
24
|
-
activemodel (5.
|
25
|
-
activesupport (= 5.
|
26
|
-
activerecord (5.
|
27
|
-
activemodel (= 5.
|
28
|
-
activesupport (= 5.
|
29
|
-
arel (
|
30
|
-
activesupport (5.
|
24
|
+
activemodel (5.1.4)
|
25
|
+
activesupport (= 5.1.4)
|
26
|
+
activerecord (5.1.4)
|
27
|
+
activemodel (= 5.1.4)
|
28
|
+
activesupport (= 5.1.4)
|
29
|
+
arel (~> 8.0)
|
30
|
+
activesupport (5.1.4)
|
31
31
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
32
32
|
i18n (~> 0.7)
|
33
33
|
minitest (~> 5.1)
|
34
34
|
tzinfo (~> 1.1)
|
35
|
-
arel (
|
35
|
+
arel (8.0.0)
|
36
36
|
builder (3.2.3)
|
37
37
|
byebug (9.1.0)
|
38
38
|
coderay (1.1.2)
|
@@ -95,9 +95,9 @@ GEM
|
|
95
95
|
nokogiri (>= 1.6)
|
96
96
|
rails-html-sanitizer (1.0.3)
|
97
97
|
loofah (~> 2.0)
|
98
|
-
railties (5.
|
99
|
-
actionpack (= 5.
|
100
|
-
activesupport (= 5.
|
98
|
+
railties (5.1.4)
|
99
|
+
actionpack (= 5.1.4)
|
100
|
+
activesupport (= 5.1.4)
|
101
101
|
method_source
|
102
102
|
rake (>= 0.8.7)
|
103
103
|
thor (>= 0.18.1, < 2.0)
|
@@ -132,7 +132,7 @@ PLATFORMS
|
|
132
132
|
ruby
|
133
133
|
|
134
134
|
DEPENDENCIES
|
135
|
-
activerecord (>= 5.2
|
135
|
+
activerecord (>= 5.1, < 5.2)
|
136
136
|
bundler (~> 1.12)
|
137
137
|
database_cleaner (~> 1.5, >= 1.5.3)
|
138
138
|
generator_spec (~> 0.9.4)
|
@@ -141,7 +141,6 @@ DEPENDENCIES
|
|
141
141
|
mysql2 (~> 0.4.9)
|
142
142
|
pg
|
143
143
|
pry-byebug
|
144
|
-
railties (>= 5.2.0.beta1)
|
145
144
|
rake (~> 12, >= 12.2.1)
|
146
145
|
rspec (~> 3.0)
|
147
146
|
sqlite3
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ Installation
|
|
52
52
|
Add this line to your application's Gemfile:
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
gem 'mobility', '~> 0.3.
|
55
|
+
gem 'mobility', '~> 0.3.1'
|
56
56
|
```
|
57
57
|
|
58
58
|
Mobility is cryptographically signed. To be sure the gem you install hasn't
|
@@ -96,6 +96,7 @@ with the lines:
|
|
96
96
|
Mobility.configure do |config|
|
97
97
|
config.default_backend = :key_value
|
98
98
|
config.accessor_method = :translates
|
99
|
+
config.query_method = :i18n
|
99
100
|
end
|
100
101
|
```
|
101
102
|
|
@@ -30,32 +30,39 @@ AR::Dirty plugin adds support for the following persistence-specific methods
|
|
30
30
|
def initialize(*attribute_names)
|
31
31
|
super
|
32
32
|
@attribute_names = attribute_names
|
33
|
-
define_method_overrides
|
33
|
+
define_method_overrides if ::ActiveRecord::VERSION::STRING < '5.2'
|
34
34
|
define_attribute_methods if ::ActiveRecord::VERSION::STRING >= '5.1'
|
35
35
|
end
|
36
36
|
|
37
|
-
# Overrides +ActiveRecord::AttributeMethods::ClassMethods#has_attribute+ and
|
38
|
-
# +ActiveModel::AttributeMethods#_read_attribute+ to
|
39
|
-
# fallthrough attribute methods
|
37
|
+
# Overrides +ActiveRecord::AttributeMethods::ClassMethods#has_attribute+ (in AR 5.1) and
|
38
|
+
# +ActiveModel::AttributeMethods#_read_attribute+ (in AR >= 5.2) to
|
39
|
+
# ensure that fallthrough attribute methods are treated like "real"
|
40
|
+
# attribute methods.
|
40
41
|
#
|
41
|
-
# @note Patching +has_attribute?+ is necessary
|
42
|
-
# (I have voiced my opposition to this change here[https://github.com/rails/rails/pull/27963#issuecomment-310092787]).
|
42
|
+
# @note Patching +has_attribute?+ is necessary in AR 5.1 due to this commit[https://github.com/rails/rails/commit/4fed08fa787a316fa51f14baca9eae11913f5050].
|
43
43
|
# @param [Attributes] attributes
|
44
44
|
def included(model_class)
|
45
45
|
super
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
|
47
|
+
if ::ActiveRecord::VERSION::MAJOR == 5 && ::ActiveRecord::VERSION::MINOR == 1
|
48
|
+
names = @attribute_names
|
49
|
+
method_name_regex = /\A(#{names.join('|'.freeze)})_([a-z]{2}(_[a-z]{2})?)(=?|\??)\z/.freeze
|
50
|
+
has_attribute = Module.new do
|
51
|
+
define_method :has_attribute? do |attr_name|
|
52
|
+
super(attr_name) || !!method_name_regex.match(attr_name)
|
53
|
+
end
|
51
54
|
end
|
55
|
+
model_class.extend has_attribute
|
56
|
+
elsif ::ActiveRecord::VERSION::STRING >= '5.2'
|
57
|
+
model_class.include ReadAttribute
|
52
58
|
end
|
53
|
-
model_class.extend has_attribute
|
54
|
-
model_class.include ReadAttribute if ::ActiveRecord::VERSION::STRING >= '5.2'
|
55
59
|
end
|
56
60
|
|
57
61
|
private
|
58
62
|
|
63
|
+
# @note These method overrides are needed for AR versions < 5.2,
|
64
|
+
# since AR::Dirty overrides AM::Dirty, disabling previous_changes
|
65
|
+
# from being set. Here we "undo" that.
|
59
66
|
def define_method_overrides
|
60
67
|
changes_applied_method = ::ActiveRecord::VERSION::STRING < '5.1' ? :changes_applied : :changes_internally_applied
|
61
68
|
define_method changes_applied_method do
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
eGDROPZoL5RXwiOnRbexxa7dcAxMrDfGB/hpiunIPWPsi4n5P7K/6OO/sGVMl9xv
|
31
31
|
SZBPXjzrHdyOFLBYXB+PG7s3F/4=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2017-
|
33
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: request_store
|
metadata.gz.sig
CHANGED
Binary file
|