five-two-nw-olivander 0.2.0.31 → 0.2.0.32

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: a1527b1808409e4c9fd29465a1c0744806daa5084e78117072eef5df8948526c
4
- data.tar.gz: 768af4436b656b56a64c1e614d8eaf8b2107d5a12af485c5101e05b64b62e8a7
3
+ metadata.gz: 3aa4679fd3ac4496649900ee060cb20b1826f8e1b43c4757d548a9d5b77b6e4c
4
+ data.tar.gz: 61615323b1201dbd021800a5525062036bc80aab414c36028aa4e43c8ab1e2d0
5
5
  SHA512:
6
- metadata.gz: 7c8682757f8441cf012c6204b32f7168b93bcbddf890c3f79793235cf8b3038dfd0c68c67b62536a0af12fcc66eeb50b759294682a7592f796deaa3998d7c5cb
7
- data.tar.gz: 895aa1992d3e2583d7380f145fa02f6c89fc9b700d9f378f95f85ab3cb7a3830f4b1b22b12923295da4145dc84ff7b478b804232d4c32ed289a08584308c7ba7
6
+ metadata.gz: 50bc6dc97b5826eef4ec98b15e20f11560a758f4b9c82b42e04d6962bc492cb697caa9094264ded682f0afdfc3195122953313595809f6a428aef461b9b68ea9
7
+ data.tar.gz: 577a779f683e1a5a5719747dc74f585633628186025770629b0e847c99fbfe47a573a045fbe1775cb15e0a75ed54c89b536a6bc7d5b1bfeb9bec9bfb6e090902
@@ -66,10 +66,11 @@ module Olivander
66
66
  reflections.map{ |x| x[1] }
67
67
  .filter{ |x| x.foreign_key == inc || x.name == inc }
68
68
  .each do |r|
69
+ type = r.association_class.name.demodulize.underscore.to_sym
69
70
  begin
70
- resource_field(r.name, r.association_class.name.demodulize.underscore.to_sym, editable: editable && !r.options.keys.include?(:through))
71
+ resource_field(r.name, type, editable: editable && !uneditable_association?(r, type))
71
72
  rescue NotImplementedError
72
- resource_field(r.name, :association, editable: editable && !r.options.keys.include?(:through))
73
+ resource_field(r.name, :association, editable: editable && !uneditable_association?(r, type))
73
74
  end
74
75
  end
75
76
 
@@ -82,6 +83,13 @@ module Olivander
82
83
  end
83
84
  end
84
85
 
86
+ def self.uneditable_association?(r, type)
87
+ return false unless r.options.keys.include?(:through)
88
+
89
+ # this collection may prove to be larger than one...
90
+ %i[has_one_through_association].include?(type)
91
+ end
92
+
85
93
  def self.resource_field_group(key = :default, editable: true, &block)
86
94
  self.resource_field_group_collection ||= []
87
95
  self.current_resource_field_group = resource_field_group_collection.select{ |x| x.key == key}.first
@@ -2,5 +2,5 @@
2
2
 
3
3
  # needed for gem
4
4
  module Olivander
5
- VERSION = '0.2.0.31'
5
+ VERSION = '0.2.0.32'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five-two-nw-olivander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.31
4
+ version: 0.2.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
11
+ date: 2024-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick