mobility 0.8.8 → 1.0.0.alpha

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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +56 -0
  5. data/Gemfile +52 -16
  6. data/Gemfile.lock +113 -52
  7. data/Guardfile +23 -1
  8. data/README.md +184 -92
  9. data/Rakefile +6 -4
  10. data/lib/mobility.rb +40 -166
  11. data/lib/mobility/active_record/translation.rb +1 -1
  12. data/lib/mobility/arel/nodes/pg_ops.rb +1 -1
  13. data/lib/mobility/backend.rb +19 -41
  14. data/lib/mobility/backends.rb +20 -0
  15. data/lib/mobility/backends/active_record.rb +4 -0
  16. data/lib/mobility/backends/active_record/column.rb +2 -0
  17. data/lib/mobility/backends/active_record/container.rb +4 -2
  18. data/lib/mobility/backends/active_record/hstore.rb +2 -0
  19. data/lib/mobility/backends/active_record/json.rb +2 -0
  20. data/lib/mobility/backends/active_record/jsonb.rb +2 -0
  21. data/lib/mobility/backends/active_record/key_value.rb +5 -3
  22. data/lib/mobility/backends/active_record/pg_hash.rb +1 -1
  23. data/lib/mobility/backends/active_record/serialized.rb +2 -0
  24. data/lib/mobility/backends/active_record/table.rb +5 -3
  25. data/lib/mobility/backends/column.rb +0 -6
  26. data/lib/mobility/backends/container.rb +2 -1
  27. data/lib/mobility/backends/hash.rb +39 -0
  28. data/lib/mobility/backends/hstore.rb +0 -1
  29. data/lib/mobility/backends/json.rb +0 -1
  30. data/lib/mobility/backends/jsonb.rb +0 -1
  31. data/lib/mobility/backends/key_value.rb +22 -14
  32. data/lib/mobility/backends/null.rb +2 -0
  33. data/lib/mobility/backends/sequel.rb +3 -0
  34. data/lib/mobility/backends/sequel/column.rb +2 -0
  35. data/lib/mobility/backends/sequel/container.rb +3 -1
  36. data/lib/mobility/backends/sequel/hstore.rb +2 -0
  37. data/lib/mobility/backends/sequel/json.rb +2 -0
  38. data/lib/mobility/backends/sequel/jsonb.rb +3 -1
  39. data/lib/mobility/backends/sequel/key_value.rb +8 -6
  40. data/lib/mobility/backends/sequel/serialized.rb +2 -0
  41. data/lib/mobility/backends/sequel/table.rb +5 -2
  42. data/lib/mobility/backends/serialized.rb +1 -3
  43. data/lib/mobility/backends/table.rb +14 -6
  44. data/lib/mobility/pluggable.rb +36 -0
  45. data/lib/mobility/plugin.rb +260 -0
  46. data/lib/mobility/plugins.rb +26 -25
  47. data/lib/mobility/plugins/active_model.rb +17 -0
  48. data/lib/mobility/plugins/active_model/cache.rb +26 -0
  49. data/lib/mobility/plugins/active_model/dirty.rb +310 -54
  50. data/lib/mobility/plugins/active_record.rb +34 -0
  51. data/lib/mobility/plugins/active_record/backend.rb +25 -0
  52. data/lib/mobility/plugins/active_record/cache.rb +28 -0
  53. data/lib/mobility/plugins/active_record/dirty.rb +72 -101
  54. data/lib/mobility/plugins/active_record/query.rb +48 -34
  55. data/lib/mobility/plugins/active_record/uniqueness_validation.rb +60 -0
  56. data/lib/mobility/plugins/attribute_methods.rb +28 -20
  57. data/lib/mobility/plugins/attributes.rb +70 -0
  58. data/lib/mobility/plugins/backend.rb +138 -0
  59. data/lib/mobility/plugins/backend_reader.rb +34 -0
  60. data/lib/mobility/plugins/cache.rb +59 -24
  61. data/lib/mobility/plugins/default.rb +22 -17
  62. data/lib/mobility/plugins/dirty.rb +12 -33
  63. data/lib/mobility/plugins/fallbacks.rb +51 -43
  64. data/lib/mobility/plugins/fallthrough_accessors.rb +26 -25
  65. data/lib/mobility/plugins/locale_accessors.rb +25 -35
  66. data/lib/mobility/plugins/presence.rb +28 -21
  67. data/lib/mobility/plugins/query.rb +8 -17
  68. data/lib/mobility/plugins/reader.rb +50 -0
  69. data/lib/mobility/plugins/sequel.rb +34 -0
  70. data/lib/mobility/plugins/sequel/backend.rb +25 -0
  71. data/lib/mobility/plugins/sequel/cache.rb +24 -0
  72. data/lib/mobility/plugins/sequel/dirty.rb +45 -32
  73. data/lib/mobility/plugins/sequel/query.rb +21 -6
  74. data/lib/mobility/plugins/writer.rb +44 -0
  75. data/lib/mobility/translations.rb +95 -0
  76. data/lib/mobility/version.rb +12 -1
  77. data/lib/rails/generators/mobility/templates/initializer.rb +95 -77
  78. metadata +51 -51
  79. metadata.gz.sig +0 -0
  80. data/lib/mobility/active_model.rb +0 -4
  81. data/lib/mobility/active_model/backend_resetter.rb +0 -26
  82. data/lib/mobility/active_record.rb +0 -23
  83. data/lib/mobility/active_record/backend_resetter.rb +0 -26
  84. data/lib/mobility/active_record/uniqueness_validator.rb +0 -60
  85. data/lib/mobility/attributes.rb +0 -324
  86. data/lib/mobility/backend/orm_delegator.rb +0 -44
  87. data/lib/mobility/backend_resetter.rb +0 -50
  88. data/lib/mobility/configuration.rb +0 -138
  89. data/lib/mobility/fallbacks.rb +0 -28
  90. data/lib/mobility/interface.rb +0 -0
  91. data/lib/mobility/loaded.rb +0 -4
  92. data/lib/mobility/plugins/active_record/attribute_methods.rb +0 -38
  93. data/lib/mobility/plugins/cache/translation_cacher.rb +0 -40
  94. data/lib/mobility/sequel.rb +0 -9
  95. data/lib/mobility/sequel/backend_resetter.rb +0 -23
  96. data/lib/mobility/translates.rb +0 -73
@@ -1,90 +1,108 @@
1
1
  Mobility.configure do |config|
2
- # Sets the default backend to use in models. This can be overridden in models
3
- # by passing +backend: ...+ to +translates+.
4
- config.default_backend = :key_value
5
2
 
6
- # By default, Mobility uses the +translates+ class method in models to
7
- # describe translated attributes, but you can configure this method to be
8
- # whatever you like. This may be useful if using Mobility alongside another
9
- # translation gem which uses the same method name.
10
- config.accessor_method = :translates
3
+ # PLUGINS
4
+ config.plugins do
5
+ # Backend
6
+ #
7
+ # Sets the default backend to use in models. This can be overridden in models
8
+ # by passing +backend: ...+ to +translates+.
9
+ #
10
+ # To default to a different backend globally, replace +:key_value+ by another
11
+ # backend name.
12
+ #
13
+ backend :key_value
11
14
 
12
- # To query on translated attributes, you need to append a scope to your
13
- # model. The name of this scope is +i18n+ by default, but this can be changed
14
- # to something else.
15
- config.query_method = :i18n
15
+ # ActiveRecord
16
+ #
17
+ # Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins.
18
+ active_record
16
19
 
17
- # Uncomment and remove (or add) items to (from) this list to completely
18
- # disable/enable plugins globally (so they cannot be used and are never even
19
- # loaded). Note that if you remove an item from the list, you will not be
20
- # able to use the plugin at all, and any options for the plugin will be
21
- # ignored by models. (In most cases, you probably don't want to change this.)
22
- #
23
- # config.plugins = %i[
24
- # query
25
- # cache
26
- # dirty
27
- # fallbacks
28
- # presence
29
- # default
30
- # attribute_methods
31
- # fallthrough_accessors
32
- # locale_accessors
33
- # ]
20
+ # Accessors
21
+ #
22
+ # Define reader and writer methods for translated attributes. Remove either
23
+ # to disable globally, or pass +reader: false+ or +writer: false+ to
24
+ # +translates+ in any translated model.
25
+ #
26
+ reader
27
+ writer
34
28
 
35
- # The translation cache is on by default, but you can turn it off by
36
- # uncommenting this line. (This may be helpful in debugging.)
37
- #
38
- # config.default_options[:cache] = false
29
+ # Backend Reader
30
+ #
31
+ # Defines reader to access the backend for any attribute, of the form
32
+ # +<attribute>_backend+.
33
+ #
34
+ backend_reader
35
+ #
36
+ # Or pass an interpolation string to define a different pattern:
37
+ # backend_reader "%s_translations"
39
38
 
40
- # Dirty tracking is disabled by default. Uncomment this line to enable it.
41
- # If you enable this, you should also enable +locale_accessors+ by default
42
- # (see below).
43
- #
44
- # config.default_options[:dirty] = true
39
+ # Query
40
+ #
41
+ # Defines a scope on the model class which allows querying on
42
+ # translated attributes. The default scope is named +i18n+, pass a different
43
+ # name as default to change the global default, or to +translates+ in any
44
+ # model to change it for that model alone.
45
+ #
46
+ query
45
47
 
46
- # No fallbacks are used by default. To define default fallbacks, uncomment
47
- # and set the default fallback option value here. A "true" value will use
48
- # whatever is defined by +I18n.fallbacks+ (if defined), or alternatively will
49
- # fallback to your +I18n.default_locale+.
50
- #
51
- # config.default_options[:fallbacks] = true
48
+ # Cache
49
+ #
50
+ # Comment out to disable caching reads and writes.
51
+ #
52
+ cache
52
53
 
53
- # The Presence plugin converts empty strings to nil when fetching and setting
54
- # translations. By default it is on, uncomment this line to turn it off.
55
- #
56
- # config.default_options[:presence] = false
54
+ # Dirty
55
+ #
56
+ # Uncomment this line to include and enable globally:
57
+ # dirty
58
+ #
59
+ # Or uncomment this line to include but disable by default, and only enable
60
+ # per model by passing +dirty: true+ to +translates+.
61
+ # dirty false
57
62
 
58
- # Set a default value to use if the translation is nil. By default this is
59
- # off, uncomment and set a default to use it across all models (you probably
60
- # don't want to do that).
61
- #
62
- # config.default_options[:default] = ...
63
+ # Fallbacks
64
+ #
65
+ # Uncomment line below to enable fallbacks, using +I18n.fallbacks+.
66
+ # fallbacks
67
+ #
68
+ # Or uncomment this line to enable fallbacks with a global default.
69
+ # fallbacks { :pt => :en }
63
70
 
64
- # Uncomment to enable locale_accessors by default on models. A true value
65
- # will use the locales defined either in
66
- # Rails.application.config.i18n.available_locales or I18n.available_locales.
67
- # If you want something else, pass an array of locales instead.
68
- #
69
- # config.default_options[:locale_accessors] = true
71
+ # Presence
72
+ #
73
+ # Converts blank strings to nil on reads and writes. Comment out to
74
+ # disable.
75
+ #
76
+ presence
70
77
 
71
- # Uncomment to enable fallthrough accessors by default on models. This will
72
- # allow you to call any method with a suffix like _en or _pt_br, and Mobility
73
- # will catch the suffix and convert it into a locale in +method_missing+. If
74
- # you don't need this kind of open-ended fallthrough behavior, it's better
75
- # to use locale_accessors instead (which define methods) since method_missing
76
- # is very slow. (You can use both fallthrough and locale accessor plugins
77
- # together without conflict.)
78
- #
79
- # Note: The dirty plugin enables fallthrough_accessors by default.
80
- #
81
- # config.default_options[:fallthrough_accessors] = true
78
+ # Default
79
+ #
80
+ # Set a default translation per attributes. When enabled, passing +default:
81
+ # 'foo'+ sets a default translation string to show in case no translation is
82
+ # present. Can also be passed a proc.
83
+ #
84
+ # default 'foo'
82
85
 
83
- # You can also include backend-specific default options. For example, if you
84
- # want to default to using the text-type translation table with the KeyValue
85
- # backend, you can set that as a default by uncommenting this line, or change
86
- # it to :string to default to the string-type translation table instead. (For
87
- # other backends, this option is ignored.)
88
- #
89
- # config.default_options[:type] = :text
86
+ # Fallthrough Accessors
87
+ #
88
+ # Uses method_missing to define locale-specific accessor methods like
89
+ # +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated
90
+ # attribute. If you know what set of locales you want to support, it's
91
+ # generally better to use Locale Accessors (or both together) since
92
+ # +method_missing+ is very slow. (You can use both fallthrough and locale
93
+ # accessor plugins together without conflict.)
94
+ #
95
+ # fallthrough_accessors
96
+
97
+ # Locale Accessors
98
+ #
99
+ # Uses +def+ to define accessor methods for a set of locales. By default uses
100
+ # +I18n.available_locales+, but you can pass the set of locales with
101
+ # +translates+ and/or set a global default here.
102
+ #
103
+ # locale_accessors
104
+ #
105
+ # Or define specific defaults by uncommenting line below
106
+ # locale_accessors [:en, :ja]
107
+ end
90
108
  end
metadata CHANGED
@@ -1,41 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 1.0.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MQ4wDAYDVQQDDAVjaHJp
14
- czEYMBYGCgmSJomT8ixkARkWCGRlamltYXRhMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE5MDkxNzIxNTE0NFoXDTIwMDkxNjIxNTE0NFowPzEOMAwGA1UEAwwFY2hy
16
- aXMxGDAWBgoJkiaJk/IsZAEZFghkZWppbWF0YTETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggG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BAMCBLAwHQYDVR0OBBYEFOO4919GTuKTQA2Klo2QO3jGlbJTMB0GA1Ud
26
+ EQQWMBSBEmNocmlzQGRlamltc3RhLmNvbTAdBgNVHRIEFjAUgRJjaHJpc0BkZWpp
27
+ bXN0YS5jb20wDQYJKoZIhvcNAQELBQADggGBADfIFBldH77wyUv2RZ1kwvuvRvpL
28
+ RNFdQlCbuVSn3abRAmc9rIsh80syhjWjYnml3guf+g2tYB1rU3NeTFRVupdvcUWJ
29
+ T6mITUeDHpNoxF6KAp3zSsdoBoEHdOBNH7Jpxp+L3a2LZ0k6fW12xEafmymOD3fp
30
+ BmIrE2Vr9aUec2Sk4fbKEYqsxhmXx+o8kKU7tnxVYMv4cX5X3yo45FA7Rh2JQuub
31
+ MBT+NALoYFaSTHWIr/4tAolWVt8NNGUKEokaFjjf5gAGM6piq6ohTHl5dCtcEPX1
32
+ klHOa2pIFwuUAWoVCpZa9XzRV5qz+mUrU70DF9dX6Cotv/sKOIxiGvQLnwzlSQWH
33
+ iXMqkM6Y5FSwViOQy4U2egDDSTB5a16iAnN7/qzqex6SYTsQdSmyc0mWCb9rkIoF
34
+ gSQml7TqcC6dZRsZRwYqzD9kUwdAJoCqno2CBUKs2l0yQAjFT36lRrVJznb7uWwa
35
+ xpPFnsrtyaZW6Dty8TSG3qzmeGpmpIotA8x1VA==
37
36
  -----END CERTIFICATE-----
38
- date: 2019-09-17 00:00:00.000000000 Z
37
+ date: 2020-10-25 00:00:00.000000000 Z
39
38
  dependencies:
40
39
  - !ruby/object:Gem::Dependency
41
40
  name: request_store
@@ -157,23 +156,15 @@ files:
157
156
  - README.md
158
157
  - Rakefile
159
158
  - lib/mobility.rb
160
- - lib/mobility/active_model.rb
161
- - lib/mobility/active_model/backend_resetter.rb
162
- - lib/mobility/active_record.rb
163
- - lib/mobility/active_record/backend_resetter.rb
164
159
  - lib/mobility/active_record/model_translation.rb
165
160
  - lib/mobility/active_record/string_translation.rb
166
161
  - lib/mobility/active_record/text_translation.rb
167
162
  - lib/mobility/active_record/translation.rb
168
- - lib/mobility/active_record/uniqueness_validator.rb
169
163
  - lib/mobility/arel.rb
170
164
  - lib/mobility/arel/nodes.rb
171
165
  - lib/mobility/arel/nodes/pg_ops.rb
172
166
  - lib/mobility/arel/visitor.rb
173
- - lib/mobility/attributes.rb
174
167
  - lib/mobility/backend.rb
175
- - lib/mobility/backend/orm_delegator.rb
176
- - lib/mobility/backend_resetter.rb
177
168
  - lib/mobility/backends.rb
178
169
  - lib/mobility/backends/active_record.rb
179
170
  - lib/mobility/backends/active_record/column.rb
@@ -187,6 +178,7 @@ files:
187
178
  - lib/mobility/backends/active_record/table.rb
188
179
  - lib/mobility/backends/column.rb
189
180
  - lib/mobility/backends/container.rb
181
+ - lib/mobility/backends/hash.rb
190
182
  - lib/mobility/backends/hash_valued.rb
191
183
  - lib/mobility/backends/hstore.rb
192
184
  - lib/mobility/backends/json.rb
@@ -205,20 +197,23 @@ files:
205
197
  - lib/mobility/backends/sequel/table.rb
206
198
  - lib/mobility/backends/serialized.rb
207
199
  - lib/mobility/backends/table.rb
208
- - lib/mobility/configuration.rb
209
- - lib/mobility/fallbacks.rb
210
- - lib/mobility/interface.rb
211
- - lib/mobility/loaded.rb
200
+ - lib/mobility/pluggable.rb
201
+ - lib/mobility/plugin.rb
212
202
  - lib/mobility/plugins.rb
213
203
  - lib/mobility/plugins/active_model.rb
204
+ - lib/mobility/plugins/active_model/cache.rb
214
205
  - lib/mobility/plugins/active_model/dirty.rb
215
206
  - lib/mobility/plugins/active_record.rb
216
- - lib/mobility/plugins/active_record/attribute_methods.rb
207
+ - lib/mobility/plugins/active_record/backend.rb
208
+ - lib/mobility/plugins/active_record/cache.rb
217
209
  - lib/mobility/plugins/active_record/dirty.rb
218
210
  - lib/mobility/plugins/active_record/query.rb
211
+ - lib/mobility/plugins/active_record/uniqueness_validation.rb
219
212
  - lib/mobility/plugins/attribute_methods.rb
213
+ - lib/mobility/plugins/attributes.rb
214
+ - lib/mobility/plugins/backend.rb
215
+ - lib/mobility/plugins/backend_reader.rb
220
216
  - lib/mobility/plugins/cache.rb
221
- - lib/mobility/plugins/cache/translation_cacher.rb
222
217
  - lib/mobility/plugins/default.rb
223
218
  - lib/mobility/plugins/dirty.rb
224
219
  - lib/mobility/plugins/fallbacks.rb
@@ -226,11 +221,13 @@ files:
226
221
  - lib/mobility/plugins/locale_accessors.rb
227
222
  - lib/mobility/plugins/presence.rb
228
223
  - lib/mobility/plugins/query.rb
224
+ - lib/mobility/plugins/reader.rb
229
225
  - lib/mobility/plugins/sequel.rb
226
+ - lib/mobility/plugins/sequel/backend.rb
227
+ - lib/mobility/plugins/sequel/cache.rb
230
228
  - lib/mobility/plugins/sequel/dirty.rb
231
229
  - lib/mobility/plugins/sequel/query.rb
232
- - lib/mobility/sequel.rb
233
- - lib/mobility/sequel/backend_resetter.rb
230
+ - lib/mobility/plugins/writer.rb
234
231
  - lib/mobility/sequel/column_changes.rb
235
232
  - lib/mobility/sequel/hash_initializer.rb
236
233
  - lib/mobility/sequel/model_translation.rb
@@ -238,7 +235,7 @@ files:
238
235
  - lib/mobility/sequel/string_translation.rb
239
236
  - lib/mobility/sequel/text_translation.rb
240
237
  - lib/mobility/sequel/translation.rb
241
- - lib/mobility/translates.rb
238
+ - lib/mobility/translations.rb
242
239
  - lib/mobility/util.rb
243
240
  - lib/mobility/version.rb
244
241
  - lib/rails/generators/mobility/active_record_migration_compatibility.rb
@@ -258,8 +255,11 @@ files:
258
255
  homepage: https://github.com/shioyama/mobility
259
256
  licenses:
260
257
  - MIT
261
- metadata: {}
262
- post_install_message:
258
+ metadata:
259
+ homepage_uri: https://github.com/shioyama/mobility
260
+ source_code_uri: https://github.com/shioyama/mobility
261
+ changelog_uri: https://github.com/shioyama/mobility/blob/master/CHANGELOG.md
262
+ post_install_message:
263
263
  rdoc_options: []
264
264
  require_paths:
265
265
  - lib
@@ -267,15 +267,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
267
  requirements:
268
268
  - - ">="
269
269
  - !ruby/object:Gem::Version
270
- version: 2.3.7
270
+ version: '2.5'
271
271
  required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - ">="
273
+ - - ">"
274
274
  - !ruby/object:Gem::Version
275
- version: '0'
275
+ version: 1.3.1
276
276
  requirements: []
277
- rubygems_version: 3.0.2
278
- signing_key:
277
+ rubygems_version: 3.1.2
278
+ signing_key:
279
279
  specification_version: 4
280
280
  summary: Pluggable Ruby translation framework
281
281
  test_files: []
metadata.gz.sig CHANGED
Binary file
@@ -1,4 +0,0 @@
1
- module Mobility
2
- module ActiveModel
3
- end
4
- end
@@ -1,26 +0,0 @@
1
- module Mobility
2
- module ActiveModel
3
- =begin
4
-
5
- Backend resetter for ActiveModel models. Adds hook to reset backend when
6
- +changes_applied+ or +clear_changes_information+ methods are called on model.
7
-
8
- =end
9
- class BackendResetter < Mobility::BackendResetter
10
-
11
- # (see Mobility::BackendResetter#initialize)
12
- def initialize(attribute_names, &block)
13
- super
14
-
15
- model_reset_method = @model_reset_method
16
-
17
- %i[changes_applied clear_changes_information].each do |method|
18
- define_method method do
19
- super()
20
- instance_eval(&model_reset_method)
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- require "mobility/arel"
3
-
4
- module Mobility
5
- =begin
6
-
7
- Module loading ActiveRecord-specific classes for Mobility models.
8
-
9
- =end
10
- module ActiveRecord
11
- require "mobility/active_record/uniqueness_validator"
12
-
13
- def self.included(model_class)
14
- model_class.class_eval do
15
- unless const_defined?(:UniquenessValidator)
16
- const_set(:UniquenessValidator,
17
- Class.new(::Mobility::ActiveRecord::UniquenessValidator))
18
- end
19
- delegate :translated_attribute_names, to: :class
20
- end
21
- end
22
- end
23
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- require "mobility/active_model/backend_resetter"
3
-
4
- module Mobility
5
- module ActiveRecord
6
- =begin
7
-
8
- Backend resetter for ActiveRecord models. Adds hook on +reload+ event to
9
- {Mobility::ActiveModel::BackendResetter}.
10
-
11
- =end
12
- class BackendResetter < Mobility::ActiveModel::BackendResetter
13
-
14
- # (see Mobility::BackendResetter#initialize)
15
- def initialize(attribute_names, &block)
16
- super
17
-
18
- model_reset_method = @model_reset_method
19
-
20
- define_method :reload do |*args|
21
- super(*args).tap { instance_eval(&model_reset_method) }
22
- end
23
- end
24
- end
25
- end
26
- end