tramway-core 1.3.1 → 1.4

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: 9e1c54c658ff2d1991d3c275b89dda31ba9cc7810b48ed86a94a237a9259d6a0
4
- data.tar.gz: 4e19d333b6437d6a2d3eb8ea0cb1f3236428935207c837a5707940bac7039524
3
+ metadata.gz: b436d58271dd2c84429b1bfc299397a66c7bfa7230da9102c2c033e962e61437
4
+ data.tar.gz: 8413118e4e1570430d93aec83539cff8049d215dba9a0a9e100e98942fc99743
5
5
  SHA512:
6
- metadata.gz: c53f5509a3bce8af5cda527af357eff760fc42934164d0fc3c2c02cde4dcef9f08fb838c3eda3bef29d8507ff5e06bafea832f7bf059920cc0d71f100521817c
7
- data.tar.gz: e224e29df97bc6a87b80dafb5d6fb35ce6e2a27b9c66bbd421eee5fe2d392472627074c81e5ad85cfa896d8e2423e7370d30d9c72d3878cb46cd3017fd71e30a
6
+ metadata.gz: 0caabf94570876be4cf2ac7dbdb297e7849163f0ec0c50711004dba6bb5ce5115311fcfa01740ceed3d7eeacf5b363ad7f8bdc63aa5671a092620aa5ff5e505e
7
+ data.tar.gz: 410070b6ba92ae42852a716e56352aefc5e19aac105933de7bf5902045a720227b4f68dedbbdee54c7092470a3b5ebc36e127077563cd5d5576ec68aed8b9bd9
@@ -42,7 +42,7 @@ class Tramway::Core::ApplicationDecorator
42
42
 
43
43
  def attributes
44
44
  object.attributes.reduce({}) do |hash, attribute|
45
- value = object.send attribute[0]
45
+ value = try(attribute[0]) ? send(attribute[0]) : object.send(attribute[0])
46
46
  if attribute[0].to_s.in? object.class.state_machines.keys.map(&:to_s)
47
47
  hash.merge! attribute[0] => object.send("human_#{attribute[0]}_name")
48
48
  elsif value.class.in? [ ActiveSupport::TimeWithZone, DateTime, Time ]
@@ -58,7 +58,7 @@ class Tramway::Core::ApplicationDecorator
58
58
  elsif value.is_a? Enumerize::Value
59
59
  hash.merge! attribute[0] => value.text
60
60
  else
61
- hash.merge! attribute[0] => attribute[1]
61
+ hash.merge! attribute[0] => value
62
62
  end
63
63
  end
64
64
  end
@@ -7,8 +7,8 @@ class Tramway::Core::ExtendableForm
7
7
  Object.const_set(name, Class.new(::Tramway::Core::ApplicationForm) do
8
8
  define_method 'submit' do |params|
9
9
  model.values ||= {}
10
- model.values = params.permit!.to_h.reduce({}) do |hash, attribute, value|
11
- hash.merge! attribute => value
10
+ model.values = params.permit!.to_h.reduce({}) do |hash, pair|
11
+ hash.merge! pair[0] => pair[1]
12
12
  end
13
13
  super params
14
14
  end
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '1.3.1'
3
+ VERSION = '1.4'
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.3.1
4
+ version: '1.4'
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-15 00:00:00.000000000 Z
11
+ date: 2018-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform-rails