forest_liana 8.0.4 → 8.0.5

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: 6cb3c745a093695e57f53f6c1202de72a1e4ff4610674cb131f65a8981acf2de
4
- data.tar.gz: 1e9f488b231111756184fd91b70196b5f852b74530ada7ed04528c03fee31792
3
+ metadata.gz: 4b5358e0a8b103d87676b9f02ba9de7dbb35670f5a03f6dc4fd7f50d44f2424a
4
+ data.tar.gz: bf58dd7d9f38ba77f1bb6317f55179a6fb42babae5b6a5b56b9c282d2e0d79f3
5
5
  SHA512:
6
- metadata.gz: 578322489d3d8dd6526e0c8104617d33c57cfbc45b5b7e37826fbdb2c303b3356376830b3ae7a007e5eaf9cdc194985de3e282e3518d41caa809e2c59fcce0d9
7
- data.tar.gz: 9f9ac533509a02ed4a47d844b7d9b6882bcada5eab228463a1260fef0456f72118b83cf312ed7b390e4520a29ea0e31767fa8acd20c2dbbc94920c130fcd4f49
6
+ metadata.gz: 0cfdec294649ddbfddf873de76ff961db3eeda40afa6a84ad679f71bddae9dd0fc16fd1d5d9992121ecfebcf335a73a11d95c893d9232b8a2e3f4fdecbb5c073
7
+ data.tar.gz: f30bb2f41054e24d88af4cf966fd7b836c4a227f1e053431769af623160ee734eacdc42e7f93d98fea729e97252b1860988e5b704fdaf0291ffa1226918c0751
@@ -72,7 +72,7 @@ module ForestLiana
72
72
 
73
73
  def dissociate
74
74
  begin
75
- dissociator = HasManyDissociator.new(@resource, @association, params)
75
+ dissociator = HasManyDissociator.new(@resource, @association, params, forest_user)
76
76
  dissociator.perform
77
77
 
78
78
  head :no_content
@@ -1,11 +1,12 @@
1
1
  module ForestLiana
2
- class HasManyDissociator < ForestLiana::ApplicationController
3
- def initialize(resource, association, params)
2
+ class HasManyDissociator
3
+ def initialize(resource, association, params, forest_user)
4
4
  @resource = resource
5
5
  @association = association
6
6
  @params = params
7
7
  @with_deletion = @params[:delete].to_s == 'true'
8
8
  @data = params['data']
9
+ @forest_user = forest_user
9
10
  end
10
11
 
11
12
  def perform
@@ -13,11 +14,10 @@ module ForestLiana
13
14
  associated_records = @resource.find(@params[:id]).send(@association.name)
14
15
 
15
16
  remove_association = !@with_deletion || @association.macro == :has_and_belongs_to_many
16
-
17
17
  if @data.is_a?(Array)
18
18
  record_ids = @data.map { |record| record[:id] }
19
19
  elsif @data.dig('attributes').present?
20
- record_ids = ForestLiana::ResourcesGetter.get_ids_from_request(@params, forest_user)
20
+ record_ids = ForestLiana::ResourcesGetter.get_ids_from_request(@params, @forest_user)
21
21
  else
22
22
  record_ids = Array.new
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "8.0.4"
2
+ VERSION = "8.0.5"
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.0.4
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 2023-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails