cats_core 1.2.5 → 1.2.9

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: 57bd0cce4510afb100e277538b46b5d090b3a5a9c48cacd4da24d9865a3a3cdd
4
- data.tar.gz: 93e64f75bf5fb2a953d4f1dbc01667746ed5454b67857a27f27c5a3bed6bc86a
3
+ metadata.gz: 5663c0eaa392c4615048690c71928842718010535c337326074509dcdfeb8330
4
+ data.tar.gz: ed4d00ce0638ff2cb9db16213fef37e5a50b6633fc8aa7e2c18faabab2d0a993
5
5
  SHA512:
6
- metadata.gz: 97092e8a99a11f22d5ad044ce913f75b5a5dc39ceb55c733ef248994a5e0686b32b6af564838127510296d8b1b3cb3bd0cae0f7f743dd3b262b9c78aa9efa2fa
7
- data.tar.gz: abcfc0f293575c891c961da89f8a038a7d83cffbe7c0c0eebb8e1cb996bc855c38f359b868db4eefaacf630f58456ae4beeb1a75d1f4e4cb80e57ab436dbc0d3
6
+ metadata.gz: 75ee5893657e7509a0644856177ef2dcab134f53b15c126e14315ed6ebd150bfb9ddff553d0fc35b6cafbad9d2e79df0387f099428a8226e973bd184f3591b3a
7
+ data.tar.gz: ae1a10d375b6c38dd0aeb9221ed46eaa0065a8295c35ef5a3ac17ec6251bb61ed873a4e67541494a6911b2623f5e82e3b455f7f7b114f65cae9fc636ef6e8e2e
@@ -5,6 +5,8 @@ module Cats
5
5
  belongs_to :transporter
6
6
 
7
7
  validates :price, presence: true, numericality: { greater_than: 0 }
8
+
9
+ delegate(:name, to: :transporter, prefix: true)
8
10
  end
9
11
  end
10
12
  end
@@ -6,11 +6,14 @@ module Cats
6
6
  STATUSES = [DRAFT, APPROVED].freeze
7
7
 
8
8
  belongs_to :requested_by, class_name: 'Cats::Core::User'
9
- belongs_to :approved_by, class_name: 'Cats::Core::User'
9
+ belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
10
10
 
11
11
  validates :reference_no, :request_date, :status, presence: true
12
12
  validates :reference_no, uniqueness: true
13
13
  validates :status, inclusion: { in: STATUSES }
14
+
15
+ delegate(:full_name, to: :requested_by, prefix: true, allow_nil: true)
16
+ delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
14
17
  end
15
18
  end
16
19
  end
@@ -5,6 +5,10 @@ module Cats
5
5
  belongs_to :source, class_name: 'Cats::Core::Location'
6
6
  belongs_to :destination, class_name: 'Cats::Core::Location'
7
7
  belongs_to :commodity
8
+
9
+ delegate(:name, to: :source, prefix: true)
10
+ delegate(:name, to: :destination, prefix: true)
11
+ delegate(:name, to: :commodity, prefix: true)
8
12
  end
9
13
  end
10
14
  end
@@ -50,6 +50,10 @@ module Cats
50
50
 
51
51
  errors.add(:phone_number, 'must be 10 or 12 digits and should match with local phone pattern')
52
52
  end
53
+
54
+ def full_name
55
+ "#{first_name} #{last_name}"
56
+ end
53
57
  end
54
58
  end
55
59
  end
@@ -9,7 +9,7 @@ class CreateCatsCoreTransportServiceRequests < ActiveRecord::Migration[6.1]
9
9
  index: { name: 'tsr_on_rb_indx' },
10
10
  foreign_key: { to_table: :cats_core_users }
11
11
  t.references :approved_by,
12
- null: false,
12
+ null: true,
13
13
  index: { name: 'tsr_on_ab_indx' },
14
14
  foreign_key: { to_table: :cats_core_users }
15
15
 
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.5'.freeze
3
+ VERSION = '1.2.9'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-11 00:00:00.000000000 Z
11
+ date: 2021-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers