lato_spaces 3.1.6 → 3.1.8

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: 3cb95e689eb475a61d486862ded250e329c60e25b6a925cec930904cb8f3ef21
4
- data.tar.gz: f9ec2d65d80d0ec50195e5fa9bf83d81fe63ee6ca119f1c4139413acc1ac61d2
3
+ metadata.gz: b2a2728c7ffc4de0d031f290f0b3e0052d0f52252877412244afc90948047e24
4
+ data.tar.gz: aebb7d8d111c3b3c70dfaaab05e1bce54ef7f06618b959b5a1c38cea76820efd
5
5
  SHA512:
6
- metadata.gz: 05acdedf498e81a921707a3d8ab7ee40bafa720f98d6b11c2388373f58520b299777d2e1eef4a5212c6edc714a2a82ffde6184ce2a1391f8abecab42fd02cbb9
7
- data.tar.gz: 6781d51842829e7d93ff109b66f38db90d5b9879ff1185f275901ed4efa134b6c0b159e3ed8a7a03144ad421ced45371f7a7536c5a687dc5ffab4bf0e7680e78
6
+ metadata.gz: 8e3ceaab436dc2dec01d13cb9db22ab5f320d4702d2e8d1f13262df3ad8ffdeea4f0982f9701cd8819bd8022a7da0f011a31b9efee934965d632cab71f36009d
7
+ data.tar.gz: 6b692ab38bc5163fb5981bbe3228947a4a13a319f2bfee216c0c78761b32bfa7ab51f72ae09c8cf9c5ee3193dfbdbfc13a999f0670844b460c2ac6cba6ab2dfc
@@ -5,7 +5,7 @@ module LatoSpaces::Associable
5
5
  # Relations
6
6
  ##
7
7
 
8
- has_many :lato_spaces_associations, class_name: 'LatoSpaces::Association', as: :item, dependent: :destroy
8
+ has_many :lato_spaces_associations, class_name: 'LatoSpaces::Association', as: :item, dependent: :nullify
9
9
  has_many :lato_spaces_groups, through: :lato_spaces_associations, class_name: 'LatoSpaces::Group'
10
10
 
11
11
  # Scopes
@@ -14,6 +14,13 @@ module LatoSpaces::Associable
14
14
  scope :for_lato_spaces_group, -> (group_id) { joins(:lato_spaces_groups).where(lato_spaces_groups: { id: group_id }) }
15
15
  scope :with_lato_spaces_groups, -> { joins(:lato_spaces_groups) }
16
16
  scope :without_lato_spaces_groups, -> { left_outer_joins(:lato_spaces_groups).where(lato_spaces_groups: { id: nil }) }
17
+
18
+ # Hooks
19
+ ##
20
+
21
+ after_destroy do
22
+ lato_spaces_associations.map(&:delete) # HACK: delete instead of destroy to avoid infinite loop caused by AssociableRequired concern
23
+ end
17
24
  end
18
25
 
19
26
  # Helpers
@@ -21,7 +21,7 @@ module LatoSpaces::AssociableRequired
21
21
 
22
22
  # listen LatoSpaces::Association destroy event to destroy item
23
23
  LatoSpaces::Association.after_destroy do |association|
24
- association.item&.destroy!
24
+ association.item.destroy!
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module LatoSpaces
2
- VERSION = "3.1.6"
2
+ VERSION = "3.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_spaces
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregorio Galante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-01 00:00:00.000000000 Z
11
+ date: 2023-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails