motor-admin 0.3.8 → 0.3.9

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: 1ff52913a60cfabf145dad356facf20ddcd67a5d34d301805b00f035892f004f
4
- data.tar.gz: 578f5f5f276856d55b9011347c5e6fe3277f8aac7827a5e919d7d87ecc6e23f9
3
+ metadata.gz: 34b8766028b5a0c018d296d77eceeb52fef2b4aa39a8d5a50acbdc0044c57791
4
+ data.tar.gz: eeeec8761595541d34b0a4ac33aca73f5308b40d11c1fc064de781c0142acdcc
5
5
  SHA512:
6
- metadata.gz: d3611e7b266ee6c5f69543e6de1ea6ca9ed6aa420d7f355d3289a7cbf52c2568aec5941b98043dbc9d1ae7ce12aced943aca8bc04a95c6e67950879622ec83ff
7
- data.tar.gz: b77573c1149ca48d113640a31ecfb979f46e71ae5625e2f584c2a6a2c31197d81be3a7cc73136a558903c043adca3a2f2f9d990db0fe69fd7fb130c289c70aa3
6
+ metadata.gz: 3f35819099fa89be904b1a20a6ee7b43d3288ae87c41bcb4cb07f32c9c2ed4b6152bc7e5922cf239409e4e0809a8bd55cae311f24341083ebd4767fc07b10db4
7
+ data.tar.gz: 14ffafaba6b7e1ecd404c1250a07f87f09d5da61e920c6f773e0fb78bb65410ad1c23271b48980e37be1f318bba681b6e3131043c7177f65abf59e10c0400ca2
@@ -55,7 +55,12 @@ module ActiveRecord
55
55
  end
56
56
 
57
57
  def aliased_table_for_relation(trail, arel_table, &block)
58
- @relation_trail[trail] ||= aliased_table_for(arel_table, &block)
58
+ @relation_trail[trail] ||=
59
+ if Rails::VERSION::MAJOR >= 6
60
+ aliased_table_for(arel_table, &block)
61
+ else
62
+ aliased_table_for(arel_table.name, trail.last, nil)
63
+ end
59
64
  end
60
65
  end
61
66
  end
@@ -210,7 +215,7 @@ module ActiveRecord
210
215
  end
211
216
 
212
217
  def expand_filter_for_column(key, column, value, relation_trail)
213
- attribute = table.arel_table[column.name]
218
+ attribute = table.send(:arel_table)[column.name]
214
219
  relation_trail.each do |rt|
215
220
  attribute = Arel::Attributes::Relation.new(attribute, rt)
216
221
  end
@@ -5,7 +5,7 @@ module Motor
5
5
  module ActiveStorageAttachmentSchema
6
6
  module_function
7
7
 
8
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
8
+ # rubocop:disable Metrics/MethodLength
9
9
  def call
10
10
  model = ActiveStorage::Attachment
11
11
 
@@ -119,7 +119,7 @@ module Motor
119
119
  visible: false
120
120
  }.with_indifferent_access
121
121
  end
122
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
122
+ # rubocop:enable Metrics/MethodLength
123
123
  end
124
124
  end
125
125
  end
@@ -256,7 +256,6 @@ module Motor
256
256
  }
257
257
  end
258
258
 
259
- # rubocop:disable Metrics/AbcSize
260
259
  def fetch_associations(model)
261
260
  model.reflections.map do |name, ref|
262
261
  next if ref.has_one? || ref.belongs_to?
@@ -281,7 +280,6 @@ module Motor
281
280
  }
282
281
  end.compact
283
282
  end
284
- # rubocop:enable Metrics/AbcSize
285
283
 
286
284
  def fetch_validators(model, column_name, reflection = nil)
287
285
  validators =
@@ -5,7 +5,6 @@ module Motor
5
5
  module BuildConfigsHash
6
6
  module_function
7
7
 
8
- # rubocop:disable Metrics/AbcSize
9
8
  def call
10
9
  cache_keys = LoadFromCache.load_cache_keys
11
10
 
@@ -21,7 +20,6 @@ module Motor
21
20
  api_configs: build_api_configs_hash(cache_keys[:api_configs])
22
21
  )
23
22
  end
24
- # rubocop:enable Metrics/AbcSize
25
23
 
26
24
  def build_queries_hash(cache_key = nil)
27
25
  Motor::Configs::LoadFromCache.load_queries(cache_key: cache_key).sort_by(&:id).map do |query|
@@ -95,7 +95,6 @@ module Motor
95
95
  end
96
96
  end
97
97
 
98
- # rubocop:disable Metrics/AbcSize
99
98
  def sync_resources(configs_hash)
100
99
  resources_index = Motor::Configs::LoadFromCache.load_resources.index_by(&:name)
101
100
 
@@ -113,7 +112,6 @@ module Motor
113
112
 
114
113
  ActiveRecordUtils.reset_id_sequence!(Motor::Resource)
115
114
  end
116
- # rubocop:enable Metrics/AbcSize
117
115
 
118
116
  def sync_taggable(records, config_items, configs_timestamp, update_proc)
119
117
  processed_records, create_items = update_taggable_items(records, config_items, update_proc)
@@ -140,18 +140,18 @@ module Motor
140
140
  end
141
141
 
142
142
  def define_has_one_reflection(klass, config)
143
- options = {
144
- class_name: config[:model_name].classify,
145
- foreign_key: config[:foreign_key],
146
- primary_key: config[:primary_key]
147
- }
148
-
149
- options = options.merge(config[:options] || {})
150
-
151
143
  if config[:model_name] == 'active_storage/attachment'
152
- klass.has_one_attached config[:name].delete_suffix('_attachment').to_sym
144
+ klass.has_one_attached(config[:name].delete_suffix('_attachment').to_sym)
153
145
  else
154
- klass.has_one(config[:name].to_sym, **options.symbolize_keys)
146
+ options = {
147
+ **klass.reflections[config[:name]]&.options.to_h,
148
+ class_name: config[:model_name].classify,
149
+ foreign_key: config[:foreign_key],
150
+ primary_key: config[:primary_key],
151
+ **config[:options].to_h
152
+ }.symbolize_keys
153
+
154
+ klass.has_one(config[:name].to_sym, **options)
155
155
  end
156
156
  end
157
157
 
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.3.8'
4
+ VERSION = '0.3.9'
5
5
  end
@@ -3963,12 +3963,10 @@
3963
3963
  "icons/zoom-question.svg.gz": "icons/zoom-question.svg.gz",
3964
3964
  "images/layers-2x.png": "images/layers-2x.png",
3965
3965
  "images/layers.png": "images/layers.png",
3966
- "images/marker-icon-2x.png": "images/marker-icon-2x.png",
3967
3966
  "images/marker-icon.png": "images/marker-icon.png",
3968
- "images/marker-shadow.png": "images/marker-shadow.png",
3969
- "main-51ca7a4e6d0745da1aa5.css.gz": "main-51ca7a4e6d0745da1aa5.css.gz",
3970
- "main-51ca7a4e6d0745da1aa5.js.LICENSE.txt": "main-51ca7a4e6d0745da1aa5.js.LICENSE.txt",
3971
- "main-51ca7a4e6d0745da1aa5.js.gz": "main-51ca7a4e6d0745da1aa5.js.gz",
3972
- "main.css": "main-51ca7a4e6d0745da1aa5.css",
3973
- "main.js": "main-51ca7a4e6d0745da1aa5.js"
3967
+ "main-6c26686ed04da32a0e42.css.gz": "main-6c26686ed04da32a0e42.css.gz",
3968
+ "main-6c26686ed04da32a0e42.js.LICENSE.txt": "main-6c26686ed04da32a0e42.js.LICENSE.txt",
3969
+ "main-6c26686ed04da32a0e42.js.gz": "main-6c26686ed04da32a0e42.js.gz",
3970
+ "main.css": "main-6c26686ed04da32a0e42.css",
3971
+ "main.js": "main-6c26686ed04da32a0e42.js"
3974
3972
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2022-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ar_lazy_preload
@@ -2202,11 +2202,9 @@ files:
2202
2202
  - ui/dist/icons/zoom-question.svg.gz
2203
2203
  - ui/dist/images/layers-2x.png
2204
2204
  - ui/dist/images/layers.png
2205
- - ui/dist/images/marker-icon-2x.png
2206
2205
  - ui/dist/images/marker-icon.png
2207
- - ui/dist/images/marker-shadow.png
2208
- - ui/dist/main-51ca7a4e6d0745da1aa5.css.gz
2209
- - ui/dist/main-51ca7a4e6d0745da1aa5.js.gz
2206
+ - ui/dist/main-6c26686ed04da32a0e42.css.gz
2207
+ - ui/dist/main-6c26686ed04da32a0e42.js.gz
2210
2208
  - ui/dist/manifest.json
2211
2209
  homepage:
2212
2210
  licenses:
Binary file
Binary file