avo 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be2cf52d21a00b0daaa30cbf6547ee007afa3a5b72e260ab960ddf7c3bbfea52
4
- data.tar.gz: c52f5c54105adda8a4f4efbbe98fe1b566dd27558d4e9117e076e20e8150de82
3
+ metadata.gz: 9cab03834ddaad490fcd3f0eb64f9ac2006dacb235c2ffb34a451139da31444a
4
+ data.tar.gz: 20c9770b7b259b0207857e4b70450b73748c5d30b7dd405662b720e5f97499ba
5
5
  SHA512:
6
- metadata.gz: 9be08eef4e6edad3c6c7789ce545047a43f62ee078ad71f1a87f91469f25b11798243c5d87293b2d0bedecf86e4a871407a4acd7c9e615430425bf83c508685a
7
- data.tar.gz: 53fa38417217d0a51ccbcd0768e882e9dd311a21c30d4b091019ec9724c0482fafe1182b4911505a5172ad2fbb9e8d14bfce5d56b6f3696b80f9730bbe4742a8
6
+ metadata.gz: e024dbbb67133f849c0b45b65694ba6322bf8e07d5ae399280e9e233b54bf26ee954aaabf8eebdfd81e33db79b007ce78a73be5fc99e5fb3b5089b4a75121d81
7
+ data.tar.gz: 1d52cf19ca6a8a831222fd36762862de3e88f8f02c4469eaa19e98844da6f707677120e0f92d13bb47caed37fa3e7cf3f24b6f7f10a049805cbe222a3653fb42
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (0.4.4)
4
+ avo (0.4.5)
5
5
  countries
6
6
  httparty
7
7
  i18n-js
@@ -22,7 +22,8 @@ module Avo
22
22
  fields[:searchable] = @searchable
23
23
  fields[:is_relation] = true
24
24
  fields[:database_id] = foreign_key model
25
- target_resource = App.get_resources.find { |r| r.class == "Avo::Resources::#{name}".safe_constantize }
25
+
26
+ target_resource = get_target_resource model
26
27
 
27
28
  relation_model = model.public_send(@relation_method)
28
29
 
@@ -61,6 +62,16 @@ module Avo
61
62
  model.class.reflections[@relation_method].foreign_key
62
63
  end
63
64
  end
65
+
66
+ def get_target_resource(model)
67
+ if model._reflections[id.to_s].klass.present?
68
+ App.get_resource_by_model_name model._reflections[id.to_s].klass.to_s
69
+ elsif model._reflections[id.to_s].options[:class_name].present?
70
+ App.get_resource_by_model_name model._reflections[id.to_s].options[:class_name]
71
+ else
72
+ App.get_resource_by_name class_name.to_s
73
+ end
74
+ end
64
75
  end
65
76
  end
66
77
  end
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-16 00:00:00.000000000 Z
12
+ date: 2020-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails