tramway-core 1.5.1 → 1.5.2

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: 5cfb4845d367cb5bfc81ab7151aa232a562714bbe9b3d2f0609ad960030ea465
4
- data.tar.gz: 07e193a08f31ad3fdd23d6cbabd8454f657c0b973b46a27111d7aa9a5d4845e6
3
+ metadata.gz: 618522505bb149acbb057252aa47de22d0818fe6cf0a0e32ca8098d20dc6541c
4
+ data.tar.gz: dad742f422cab524f4d0579ef43133937ac6a7205cf78080fd52fd710d88d9f1
5
5
  SHA512:
6
- metadata.gz: c3f29f9dfdb6396550ee273b6abad1c03c499bd1d37fb00431fad213faacf5898716234467b03d535e486b585f0c00313e6972d825d00fae5badcf85304ee39d
7
- data.tar.gz: ae3ef4540309b69afae98f85d3a0fd6d2746613dd353e3926fbc4ddd03e2a898c4ac819b25b3a85450426f40fcc35fba6c793877a7a9147da1292f3036b08c44
6
+ metadata.gz: ee07e8ce64c7a7bcd5a19698509ff11a073454d356f8eba5e34cc2d10bf14a0a83cd6e07f4bcb5cfe375250eefff5e52391a7525224bc77d1ece1b43afcc2418
7
+ data.tar.gz: e6f696f20c29348fd7f75fd1c193a7d320eace9dde4a33b773e3b99c874a0792721615df6ac7e3ceb0ac8344adc0f4164334de6e86532f147772486e80eb9657
@@ -3,11 +3,12 @@ module Tramway::Core
3
3
  def initialize(object)
4
4
  super(object).tap do
5
5
  @@associations&.each do |association|
6
- class_name = object.class.reflect_on_all_associations(:belongs_to).select do |a|
6
+ options = object.class.reflect_on_all_associations(:belongs_to).select do |a|
7
7
  a.name == association.to_sym
8
- end.first&.options&.require(:class_name)&.constantize
9
- next unless class_name
8
+ end.first&.options
9
+ next unless options
10
10
 
11
+ class_name = options[:class_name].constantize
11
12
  self.class.send(:define_method, "#{association}=") do |value|
12
13
  super class_name.find value
13
14
  end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '1.5.1'
3
+ VERSION = '1.5.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-20 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform-rails