cats_core 1.0.25 → 1.0.26

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: 3b4daffc3ad671e1f4b955ec649f6186cc8048ffc0a74972292e2b745460b28c
4
- data.tar.gz: a75cb602fd8859e7e39f064212cee3daafc6a8dfda04247614d2608058433183
3
+ metadata.gz: 3f7140f7b94aaf47e0b5cfcb9ad89515a6884a6f59c685d7bf3b10978d2239e8
4
+ data.tar.gz: d10e11f6f3506f4513921bb85814d1303bea873558c8603241b87df4474aa777
5
5
  SHA512:
6
- metadata.gz: 43c85afb0693fb6158597758b1a8399e6490b7fdcaf7291dda9304e02be716aab33e25f02408539a46e5b3c3adddd746e9a94ed14754999ec51048c411408041
7
- data.tar.gz: d7dc26e79aafdf1429fc0d1a40a988f9608c6db56c137cc2a46cfdeb630fa957882329fc1cca0df8dd9396651b2dcd372193eb75129d0d743da6df3e10efc961
6
+ metadata.gz: 6a63abe18b61954481d0e758aa4a714bc201d2270febe2b86c157806c8ba9a7dafc44399177079fe5bf5bfed3dc916634cfae1a711ab3030ee8c2a95cc9c514a
7
+ data.tar.gz: 0ec75ce43af82a2dd05e1b3d7836893e273741c7cbb2bc074e49582cf0231b9105d8e4d9b0f0d44a08760dd40cb9bdd83e8b1bbcb4dbbce47ae3711417de64d1
@@ -16,6 +16,7 @@ module Cats
16
16
 
17
17
  belongs_to :unit_of_measure
18
18
  belongs_to :source, polymorphic: true
19
+ belongs_to :commodity_category
19
20
 
20
21
  validates :best_use_before, presence: true
21
22
  validates :batch_no, presence: true, uniqueness: true
@@ -23,6 +24,9 @@ module Cats
23
24
  validates :volume_per_metric_ton, numericality: { greater_than: 0, allow_nil: true }
24
25
  validates :arrival_status, presence: true, inclusion: { in: ARRIVAL_STATUSES }
25
26
 
27
+ delegate(:abbreviation, to: :unit_of_measure, prefix: true)
28
+ delegate(:name, to: :commodity_category, prefix: true)
29
+
26
30
  def set_approved
27
31
  return unless new_record?
28
32
 
@@ -6,6 +6,10 @@ class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
6
6
  null: false,
7
7
  index: { name: 'uom_on_commodities_indx' },
8
8
  foreign_key: { to_table: :cats_core_unit_of_measures }
9
+ t.references :commodity_category,
10
+ null: false,
11
+ index: { name: 'cc_on_commodities_indx' },
12
+ foreign_key: { to_table: :cats_core_commodity_categories }
9
13
  t.references :source, polymorphic: true
10
14
  t.float :quantity, null: false
11
15
  t.string :description
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.25'.freeze
3
+ VERSION = '1.0.26'.freeze
4
4
  end
5
5
  end
@@ -3,6 +3,7 @@ FactoryBot.define do
3
3
  batch_no { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  unit_of_measure
6
+ commodity_category
6
7
  source factory: :gift_certificate
7
8
  quantity { 100 }
8
9
  best_use_before { Date.today + 2.month }
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.25
4
+ version: 1.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.