forest_liana 7.7.1 → 7.7.2

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: c02a63ee28d085f4d9c67052da7a2699660658be64eca344e6325d3e759723e4
4
- data.tar.gz: 3342aface5ee342ef696d794dc4566780a8c47af75bdd3ae22ebbed1485b1768
3
+ metadata.gz: 255e08fe3efa55b4d3e45bfaefd39c354dcc3d75e4c131516c878250504b53e1
4
+ data.tar.gz: a933bd8d54b97eb3358d94ee091f43c9962a9b471290f07368e5d01213ab8049
5
5
  SHA512:
6
- metadata.gz: be594c260067dbed8109038afe6f0b63322dac51d8c5635b62280e8611aad02cab0b21c44314140a988f0482d21b3df6e9a50cf7933fd9cc3b8cd63e84faae16
7
- data.tar.gz: 042f28ed3fb7b0dbbf4db36042fb16dbbabda97c874776a5729e4601b3cdf517e04d7b567f3caa4ea32db75fed11a1c4872fbf44d032ffe68a007518387619ea
6
+ metadata.gz: c9c31d5e836eb231b293c61ba924c06d97a32c3b9d53e6bc9c9e70cc1f08a1693d8711fb207e911cb4bea3afa6a887ee90ade10100ad29aa7c55a5d1694476c4
7
+ data.tar.gz: f44ec6f5110b04548904f438433df70a4f1be6f09d5bd6b448174168a8535ff46b74f649d11233921c482a223be4da36f14e376d416b698120e0a7ee5d13b9c2
@@ -369,7 +369,6 @@ module ForestLiana
369
369
 
370
370
  def attributes(active_record_class)
371
371
  return [] if @is_smart_collection
372
-
373
372
  active_record_class.column_names.select do |column_name|
374
373
  !association?(active_record_class, column_name)
375
374
  end
@@ -410,7 +409,7 @@ module ForestLiana
410
409
 
411
410
  def foreign_keys(active_record_class)
412
411
  begin
413
- SchemaUtils.associations(active_record_class).map(&:foreign_key)
412
+ SchemaUtils.belongs_to_associations(active_record_class).map(&:foreign_key)
414
413
  rescue => err
415
414
  # Association foreign_key triggers an error. Put the stacktrace and
416
415
  # returns no foreign keys.
@@ -18,6 +18,12 @@ module ForestLiana
18
18
  end
19
19
  end
20
20
 
21
+ def self.belongs_to_associations(active_record_class)
22
+ self.associations(active_record_class).select do |x|
23
+ [:belongs_to].include?(x.macro)
24
+ end
25
+ end
26
+
21
27
  def self.many_associations(active_record_class)
22
28
  self.associations(active_record_class).select do |x|
23
29
  [:has_many, :has_and_belongs_to_many].include?(x.macro)
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "7.7.1"
2
+ VERSION = "7.7.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.7.1
4
+ version: 7.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-20 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails