forest_liana 8.3.1 → 8.3.3

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: f575399255a09d606c838be6a483b043c8b517eca0a8ccca55c747334555616b
4
- data.tar.gz: fbe167b9daa4f6b3d22ddfd58e297cd3da3e020c165a548e37d8ae886c3671ed
3
+ metadata.gz: a4e97c61fafcfa35449d0198b68c6e9aa1ac070f43c09fb65337b88b75b7eb73
4
+ data.tar.gz: 56a2db7abad36e6242205497a155bc615b838148162bfa2019cc2201ae4d3aea
5
5
  SHA512:
6
- metadata.gz: 025fdca59a9d40cc79221d021f9f64b08aa95ad7cbb7035ee6f1adcc0350c00c7427cd80a25ddaebfe334c48ff83e92a30156709e1ac5a6e3701509b29bae5b9
7
- data.tar.gz: 189a32d33adc6f1d898d10328032ae2a3a36da7dfd5be070bd555afba75869b6069ae306bee9d6b9215e55efb7354c11a42092c80811c7c0659fa5e2c021d161
6
+ metadata.gz: 91031cc5688326bb38b7c8932965cd65a6aac71e0d44dc8c40867a826ab688339f0de2f14fae7723cee59e63173a3672db444391207bfe98f8ccd4000cb6af6e
7
+ data.tar.gz: 11dac2d84060f8414c97dcf8485444df9a50e20f21be995aa50f560b0003ae734b013e55ae187e00e57dd95de58fcea16d510e9a0d1a32968970a75edc181b81
@@ -76,6 +76,8 @@ module ForestLiana
76
76
  dissociator.perform
77
77
 
78
78
  head :no_content
79
+ rescue ActiveRecord::RecordNotDestroyed => error
80
+ render json: { errors: [{ status: :bad_request, detail: error.message }] }, status: :bad_request
79
81
  rescue => error
80
82
  FOREST_REPORTER.report error
81
83
  FOREST_LOGGER.error "Association Dissociate error: #{error}\n#{format_stacktrace(error)}"
@@ -17,7 +17,7 @@ module ForestLiana
17
17
  if @data.nil?
18
18
  new_value = nil
19
19
  else
20
- association_klass = SchemaUtils.polymorphic_models(@association).select { |a| a.name.downcase == @data[:type] }.first
20
+ association_klass = SchemaUtils.polymorphic_models(@association).select { |a| a.name == @data[:type] }.first
21
21
  new_value = association_klass.find(@data[:id]) if @data && @data[:id]
22
22
  end
23
23
  else
@@ -31,7 +31,12 @@ module ForestLiana
31
31
 
32
32
  if @with_deletion
33
33
  record_ids = record_ids.select { |record_id| @association.klass.exists?(record_id) }
34
- @association.klass.destroy(record_ids)
34
+ @resource.transaction do
35
+ record_ids.each do |id|
36
+ record = @association.klass.find(id)
37
+ record.destroy!
38
+ end
39
+ end
35
40
  end
36
41
  end
37
42
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "8.3.1"
2
+ VERSION = "8.3.3"
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: 8.3.1
4
+ version: 8.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-26 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails