motor-admin 0.1.16 → 0.1.17

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: 4844a300bd3061e7c289d0c0e36f095922b32eafbb62c61d3e5f763dfe9508da
4
- data.tar.gz: 95d56c11d15471a11c877ba319836c563d858f8c768b9c82a82fbb3d75f22b68
3
+ metadata.gz: 3f394e032aa3ede14570c098e604143b439bd73c52b1c6fa2cfa800d413efcce
4
+ data.tar.gz: edd3909478589fc8cba218c1286fe00e18732b085435a7e02bfdf824c1f363ff
5
5
  SHA512:
6
- metadata.gz: ed58d6ab04a5fe3749ab22aaa281e4d4bc618ac652612bb005653a319da55d5ca6f0f4be6f36d445295033e57f6d8296a01750659cd830f0c8f4d95b5d0360cc
7
- data.tar.gz: 5d13f12bce2d5547c3b429ff822c93ed053018a24f5c958da1dd931b08c9adec775c540765ed8e95593cfc9d8983578e8c3ca4943e8d6f48725767c0fb26cca5
6
+ metadata.gz: aed05763bda0b00ceb45839f224720ed0c199d09590d439843557967c26eb4b3fed2a38cea39f81d2d8b39c8f90cca8a7df04e07475002b6dc7130dcc7513292
7
+ data.tar.gz: b744249ec9ef523f8c8563d3d98f782e4667ac90e00dc2b82ef9d59fe873838125f5298a7dcbc15c9901c57d9e74611199631e906a33dddaea490229ce058ff1
@@ -49,27 +49,27 @@ module Motor
49
49
 
50
50
  params[:fields].each do |key, fields|
51
51
  fields = fields.split(',') if fields.is_a?(String)
52
- reflection_class = model.reflections[key]&.klass
53
- fields_hash = build_fields_hash(reflection_class || model, fields)
54
52
 
55
53
  if key == model_name || model_name.split('/').last == key
56
- json_params.merge!(fields_hash)
54
+ json_params.merge!(build_fields_hash(model, fields))
57
55
  else
58
56
  hash = find_key_in_params(json_params, key)
59
57
 
58
+ fields_hash = build_fields_hash(model.reflections[key]&.klass, fields)
59
+
60
60
  hash.merge!(fields_hash)
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
65
  def build_fields_hash(model, fields)
66
- columns = model.columns.map(&:name)
66
+ columns = model ? model.columns.map(&:name) : []
67
67
  fields_hash = { 'only' => [], 'methods' => [] }
68
68
 
69
69
  fields.each_with_object(fields_hash) do |field, acc|
70
70
  if field.in?(columns)
71
71
  acc['only'] << field
72
- elsif model.instance_methods.include?(field.to_sym)
72
+ elsif model.nil? || model.instance_methods.include?(field.to_sym)
73
73
  acc['methods'] << field
74
74
  end
75
75
  end
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.1.16'
4
+ VERSION = '0.1.17'
5
5
  end
@@ -5,9 +5,9 @@
5
5
  "fonts/ionicons.ttf?v=3.0.0-alpha.3": "fonts/ionicons.ttf",
6
6
  "fonts/ionicons.woff2?v=3.0.0-alpha.3": "fonts/ionicons.woff2",
7
7
  "fonts/ionicons.woff?v=3.0.0-alpha.3": "fonts/ionicons.woff",
8
- "main-729641083f64367ce9aa.css.gz": "main-729641083f64367ce9aa.css.gz",
9
- "main-729641083f64367ce9aa.js.LICENSE.txt": "main-729641083f64367ce9aa.js.LICENSE.txt",
10
- "main-729641083f64367ce9aa.js.gz": "main-729641083f64367ce9aa.js.gz",
11
- "main.css": "main-729641083f64367ce9aa.css",
12
- "main.js": "main-729641083f64367ce9aa.js"
8
+ "main-c1f7e0cffddc2e2ac639.css.gz": "main-c1f7e0cffddc2e2ac639.css.gz",
9
+ "main-c1f7e0cffddc2e2ac639.js.LICENSE.txt": "main-c1f7e0cffddc2e2ac639.js.LICENSE.txt",
10
+ "main-c1f7e0cffddc2e2ac639.js.gz": "main-c1f7e0cffddc2e2ac639.js.gz",
11
+ "main.css": "main-c1f7e0cffddc2e2ac639.css",
12
+ "main.js": "main-c1f7e0cffddc2e2ac639.js"
13
13
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
@@ -213,8 +213,8 @@ files:
213
213
  - lib/motor/ui_configs.rb
214
214
  - lib/motor/version.rb
215
215
  - ui/dist/fonts/ionicons.woff2
216
- - ui/dist/main-729641083f64367ce9aa.css.gz
217
- - ui/dist/main-729641083f64367ce9aa.js.gz
216
+ - ui/dist/main-c1f7e0cffddc2e2ac639.css.gz
217
+ - ui/dist/main-c1f7e0cffddc2e2ac639.js.gz
218
218
  - ui/dist/manifest.json
219
219
  homepage:
220
220
  licenses: