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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c134f78117865e131baf9ceecb0c902cb63abb08
4
- data.tar.gz: 2076ecc0e3164b962d1f5147e0af81d2ba9baac3
3
+ metadata.gz: 7758652b17c028026785aab433d317fa8508b3b1
4
+ data.tar.gz: 359c5dd578fe9f7d2f1cb3aef187aacbf3a12246
5
5
  SHA512:
6
- metadata.gz: f6ec9f5003e16ace7ea7a77136266af20f5c86beb1ebea6ae4e83598d20bdf4d14971d6f029c2b1bd74763c599287e362b7b3204c51660606ab2b371a4620842
7
- data.tar.gz: 8eae38b70cb15cb0eeec7dfb51f72e4076268312bdd73d63a9fda7611414d116e5bd95771a3042ca080ea4495c335e50a66f5c92a1beb6994e2d1d8d4c9d3bb9
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.pre.alpha)
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.2.0.beta2)
12
- actionview (= 5.2.0.beta2)
13
- activesupport (= 5.2.0.beta2)
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.2.0.beta2)
19
- activesupport (= 5.2.0.beta2)
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.2.0.beta2)
25
- activesupport (= 5.2.0.beta2)
26
- activerecord (5.2.0.beta2)
27
- activemodel (= 5.2.0.beta2)
28
- activesupport (= 5.2.0.beta2)
29
- arel (>= 9.0)
30
- activesupport (5.2.0.beta2)
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 (9.0.0)
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.2.0.beta2)
99
- actionpack (= 5.2.0.beta2)
100
- activesupport (= 5.2.0.beta2)
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.0.beta1)
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.0'
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 treat
39
- # fallthrough attribute methods just like "real" 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 as of AR 5.1 due to this commit[https://github.com/rails/rails/commit/4fed08fa787a316fa51f14baca9eae11913f5050].
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
- names = @attribute_names
47
- method_name_regex = /\A(#{names.join('|'.freeze)})_([a-z]{2}(_[a-z]{2})?)(=?|\??)\z/.freeze
48
- has_attribute = Module.new do
49
- define_method :has_attribute? do |attr_name|
50
- super(attr_name) || !!method_name_regex.match(attr_name)
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
@@ -1,3 +1,3 @@
1
1
  module Mobility
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  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: 0.3.0
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-11-30 00:00:00.000000000 Z
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