cats_core 1.0.48 → 1.0.49

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: e0cb918631b3c8651aca92abc3209f968ce85fbb0e6408332ae5683b95130333
4
- data.tar.gz: 3dca9a7897114e6bf7830951190ac504eaceb03e2f9bf1e3f7de1c5bd1158a5a
3
+ metadata.gz: 88f88c106a10c160703ee6898947a371aef510da88eea9aa514ff93e20c4e806
4
+ data.tar.gz: 2baa107b490e7372ed823c6d8fec83e91a19de41f77a48cd187e99eb2dc934bf
5
5
  SHA512:
6
- metadata.gz: a8d658d04da98b1e5607be0843fdfde3663d7ea089b56b9fd7f073420ffa00715613426233c066ca1a92f503bfd8bbc8b9a91663f633ddb93b3e779d1546496a
7
- data.tar.gz: 4aa0772c1ca60ec644476785dc96b3fe7639fcb77e2a97d76e6d757f0a44c6a8f8beb6738edd15361e4edeb41c6559f2ae9f6186bd20e601358fcf1cf1092ab9
6
+ metadata.gz: f12a36ca3a10c537f09e6fd12b07e66d70b0bc69692badb2f9a0de6642d1b91f308ba53754456ecf35da935c7a380af3e7237bdda35690177ae0823acab8ef60
7
+ data.tar.gz: fdb2ed8c53e2d0c2e554017dce091be7056004b28a9dc3b0cbc6c4e343855957afcb64de644ccefc7649372c5c29584f98f9fc78ba9f0b0e6bb24bb96c434458
@@ -2,6 +2,7 @@ module Cats
2
2
  module Core
3
3
  class Transaction < ApplicationRecord
4
4
  self.abstract_class = true
5
+ after_initialize :set_status
5
6
 
6
7
  # Transaction statuses
7
8
  DRAFT = 'Draft'.freeze
@@ -25,8 +26,16 @@ module Cats
25
26
  destination.quantity += quantity
26
27
  source.save
27
28
  destination.save
29
+ self.status = COMMITTED
30
+ save
28
31
  end
29
32
  end
33
+
34
+ def set_status
35
+ return unless new_record?
36
+
37
+ self.status = DRAFT
38
+ end
30
39
  end
31
40
  end
32
41
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.48'.freeze
3
+ VERSION = '1.0.49'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.48
4
+ version: 1.0.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.