gettext_i18n_rails 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21ca313fab159243b410640c4fdd81980a9f9a9c9f7500b904b1b520cd25a596
4
- data.tar.gz: 63f42039049902975af11131868ee12906d137151f43bdd5e86551fadc733080
3
+ metadata.gz: 69d12d7e3eebbd04ad80e403f237187601791f071ca5ff28d014b5c4a9bb08d8
4
+ data.tar.gz: cb74abbea8ef5e823ba2e6cf34c8f739ce3305d30cd7a5e431644c78e63dcc5a
5
5
  SHA512:
6
- metadata.gz: d07bbab9c35abdb23b4e208b22c08c9be2051ac64dfa043c9a47013ca6ff92c8741356b950df53e809d90003c44db6183e9167e34a83856242c6a0d80c113486
7
- data.tar.gz: aba525c859c885518513c71d2086d2bfe1cb65fa48c3781bf8ac64a9e1d8009626519011b4011d7b51f9ca10ab9a8e1ffb71dcc269586fe97ecf82ceb0afa7de
6
+ metadata.gz: a30e6228cc71ec651fcbb0a69ccc37ded90217a03e273fc3ed01eabed2993344681b4a0c40f4ae674574fd19acd3400c7913397a03573c35dfd16929ab8d5a79
7
+ data.tar.gz: fa9ec02c26510fc184b3c0d1476ca595e7f5212a30037c597cf04f535e1ecad8538f452fbd707b438073f21b979f147a26bee2b817097d5bc79055b145325409
@@ -46,6 +46,17 @@ module GettextI18nRails
46
46
  @existing_tables = (Rails::VERSION::MAJOR >= 5 ? connection.data_sources : connection.tables)
47
47
  end
48
48
 
49
+ # Rails 7.0 has deprecated direct_descendants in favor of subclasses.
50
+ # It was removed completely in Rails 7.1.
51
+ # This will maintain backwards compatibility with Rails 3.0 - 6.1
52
+ def subclass_method
53
+ if Rails::VERSION::MAJOR < 7
54
+ :direct_descendants
55
+ else
56
+ :subclasses
57
+ end
58
+ end
59
+
49
60
  # Rails < 3.0 doesn't have DescendantsTracker.
50
61
  # Instead of iterating over ObjectSpace (slow) the decision was made NOT to support
51
62
  # class hierarchies with abstract base classes in Rails 2.x
@@ -53,7 +64,7 @@ module GettextI18nRails
53
64
  return [] if model.abstract_class? && Rails::VERSION::MAJOR < 3
54
65
 
55
66
  if model.abstract_class?
56
- model.direct_descendants.reject {|m| ignored?(m.table_name, ignored_tables)}.inject([]) do |attrs, m|
67
+ model.send(subclass_method).reject {|m| ignored?(m.table_name, ignored_tables)}.inject([]) do |attrs, m|
57
68
  attrs.push(model_attributes(m, ignored_tables, ignored_cols)).flatten.uniq
58
69
  end
59
70
  elsif !ignored?(model.table_name, ignored_tables) && @existing_tables.include?(model.table_name)
@@ -68,11 +79,11 @@ module GettextI18nRails
68
79
  # Ensure autoloaders are set up before we attempt to eager load!
69
80
  Rails.application.autoloaders.each(&:setup) if Rails.application.respond_to?(:autoloaders)
70
81
  Rails.application.eager_load! # make sure that all models are loaded so that direct_descendants works
71
- descendants = ::ActiveRecord::Base.direct_descendants
82
+ descendants = ::ActiveRecord::Base.send(subclass_method)
72
83
 
73
84
  # In rails 5+ user models are supposed to inherit from ApplicationRecord
74
85
  if defined?(::ApplicationRecord)
75
- descendants += ApplicationRecord.direct_descendants
86
+ descendants += ApplicationRecord.send(subclass_method)
76
87
  descendants.delete ApplicationRecord
77
88
  end
78
89
 
@@ -1,3 +1,3 @@
1
1
  module GettextI18nRails
2
- Version = VERSION = '1.12.0'
2
+ Version = VERSION = '1.13.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_i18n_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_gettext
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubygems_version: 3.3.3
226
+ rubygems_version: 3.4.10
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Simple FastGettext Rails integration.