effective_resources 1.3.8 → 1.3.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9765848b329e9045efb497fd2f14866d1de0aced5bd496a58c2fd43c62ac058c
4
- data.tar.gz: '0699ac9422d95953b2351f188da65368296b87a87297477ac53c516db774c4d2'
3
+ metadata.gz: 9601649bc492726de56097e2cdf2a77b19a7d7070dcfeafdec34d3f625ba14a7
4
+ data.tar.gz: b578e2e31a8ef4bd59f20a94f382b9308585f5127af900a018fce7cfe35759fb
5
5
  SHA512:
6
- metadata.gz: 142c69175e7a513a39a4bd5671055da372a157667e5d4b24d442e2cf2b6b505b6676da2a748edcbd003d08bd8f53e86ce4901bec143b4973fdd71bcb55266185
7
- data.tar.gz: 6bf8f1ed1a7acef180b68ef03e5df2865451badae4899ccbcc3ff007c388d0948bd6ec0471bcc4dcc29a5426cc8affb4a921dbc61da2e740168895b205a4be07
6
+ metadata.gz: 231ad4e9b5088ec45c737a2eded525e7ffe7bbe3423cd12e05a914ae16a36dd9d086a14dc797bd1be0be1bf73edb140d55c2b13380a1d752f37cfdedfbef2d6e
7
+ data.tar.gz: 995a1e8c968f2c3e6d090cb6a808915d6140d27c18d98cc18ecef449b761dd8dc124a9e348f1b9e6ff2ccb660813b5b2c7cdb1ae87e9e6a3536db05dbcd8bfcb
@@ -11,11 +11,14 @@ module Effective
11
11
  constant_pluralized = name.to_s.upcase
12
12
  constant = name.to_s.pluralize.upcase
13
13
 
14
- collection = (klass.const_get(constant) rescue nil) if defined?("#{klass.name}::#{constant}")
15
- collection ||= (klass.const_get(constant_pluralized) rescue nil) if defined?("#{klass.name}::#{constant_pluralized}")
16
- collection ||= {}
14
+ collection = nil
17
15
 
18
- { as: :select, polymorphic: true, collection: collection }
16
+ if klass.respond_to?(:name)
17
+ collection ||= (klass.const_get(constant) rescue nil) if defined?("#{klass.name}::#{constant}")
18
+ collection ||= (klass.const_get(constant_pluralized) rescue nil) if defined?("#{klass.name}::#{constant_pluralized}")
19
+ end
20
+
21
+ { as: :select, polymorphic: true, collection: collection }.compact
19
22
  when :has_and_belongs_to_many
20
23
  { as: :select }.merge(search_form_field_collection(has_and_belongs_to_many(name)))
21
24
  when :has_many
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.3.8'.freeze
2
+ VERSION = '1.3.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-01 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails