tramway-core 4.0.2 → 4.0.2.1

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: '086c1596ce61b0f9aafe83893d40cadc8643782c78a1358bcd58ab045a3afd2d'
4
- data.tar.gz: b1c495936b57331fc23b9633b5e5edae566c81e7a0dfeede306e7b9da5c02f83
3
+ metadata.gz: 071cf2ccd054e5bde3e9ecc232476ec1a48d2aa4e3d51246befdd770a6e89876
4
+ data.tar.gz: 7aa40b3777e070784dd0f0ca57baf12b4fd6378e5911b1e3dfa25ec6b427e24f
5
5
  SHA512:
6
- metadata.gz: 0647b1e05efb34c3e4141c89a46d58ebb3be047180c3faf7ef927014360e4fd9e07541d7c0627352b7eaa4686c1b413b6023923988219515a2ea138a3d7d11b5
7
- data.tar.gz: 616b4165b72f1eb108a9b04568755d6d0914db54119860905756c68052a861fc6ce0270c911e9c532fec9658ac3319c7a7b34865a2726e30d605af67d8cec5fa
6
+ metadata.gz: 8ff54066670f690934e828bd599b8cbeac5ad3cf27c43d2d56f54425f0bbf38708ae9d0bea74983d35a8b08a6a5393ed88810bd5e37672290653293dcb170919
7
+ data.tar.gz: 521157e341cc6eada7c4c1c4e97b620e5233dc28d15adbe148d53daa0b397d138b4084d69228379cd6a1e45e5fe7bf065f19181080f23d3ee00fc828b4bf8636
@@ -14,14 +14,16 @@ module Tramway::Core::ApplicationForms::AssociationObjectHelpers
14
14
 
15
15
  def define_polymorphic_association(association, _class_name)
16
16
  self.class.send(:define_method, "#{association}=") do |value|
17
- association_class = value.split('_')[0..-2].join('_').camelize
18
- association_class = association_class.constantize if association_class.is_a? String
19
- if association_class.nil?
20
- Tramway::Error.raise_error :tramway, :core, :application_form, :initialize, :polymorphic_class_is_nil,
21
- association_name: association
22
- else
23
- model.send "#{association}=", association_class.find(value.split('_')[-1])
24
- send "#{association}_type=", association_class.to_s
17
+ if value.present?
18
+ association_class = value.split('_')[0..-2].join('_').camelize
19
+ association_class = association_class.constantize if association_class.is_a? String
20
+ if association_class.nil?
21
+ Tramway::Error.raise_error :tramway, :core, :application_form, :initialize, :polymorphic_class_is_nil,
22
+ association_name: association
23
+ else
24
+ model.send "#{association}=", association_class.find(value.split('_')[-1])
25
+ send "#{association}_type=", association_class.to_s
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '4.0.2'
5
+ VERSION = '4.0.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov