cats_core 1.4.39 → 1.4.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/cats/core/donation.rb +1 -1
- data/app/models/cats/core/project.rb +3 -0
- data/db/migrate/20210717032330_create_cats_core_donations.rb +0 -1
- data/db/migrate/20210717032927_create_cats_core_projects.rb +4 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/donations.rb +0 -1
- data/spec/factories/cats/core/projects.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f351b09b0928289a2d7a7eba97b0784bb459bec5e830a81648e1a6248d187cfb
|
4
|
+
data.tar.gz: 968878625a82ba3e0dca6b11264be31955c7e237c255684150d47f71d2b59ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d2f3cff48d29e0c9e2fb370be54d735b2ac0e9e2c6d549b43bfb0c181efb17bf7dc20d2a3420240e258fbd6508e7e5347e91ee59fb2cdca8d93dbed95df6edc
|
7
|
+
data.tar.gz: d1d76375ad48d4bba448318854cca83b14ad7955e3c19ca142bfa56dd9231449e042681037daae808327b1a30518514b22bbe2653abbf8d87ccf45406bb8b0dd
|
@@ -11,7 +11,7 @@ module Cats
|
|
11
11
|
belongs_to :commodity_category, optional: true
|
12
12
|
belongs_to :unit_of_measure, optional: true
|
13
13
|
|
14
|
-
validates :reference_no, :amount, :donation_type, :donated_on,
|
14
|
+
validates :reference_no, :amount, :donation_type, :donated_on, presence: true
|
15
15
|
validates :reference_no, uniqueness: true
|
16
16
|
validates :donation_type, inclusion: { in: DONATION_TYPES }
|
17
17
|
validates :currency, presence: true, if: -> { donation_type == CASH }
|
@@ -2,10 +2,13 @@ module Cats
|
|
2
2
|
module Core
|
3
3
|
class Project < ApplicationRecord
|
4
4
|
belongs_to :source, polymorphic: true
|
5
|
+
belongs_to :program
|
5
6
|
|
6
7
|
validates :code, presence: true, uniqueness: true
|
7
8
|
validates :year, :implementing_agency, presence: true
|
8
9
|
validates :year, numericality: { greater_than: 2000 }
|
10
|
+
|
11
|
+
delegate(:code, to: :program, prefix: true)
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
@@ -6,7 +6,6 @@ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
|
|
6
6
|
t.string :donation_type, null: false
|
7
7
|
t.string :shipping_reference
|
8
8
|
t.date :donated_on, null: false
|
9
|
-
t.string :agency, null: false
|
10
9
|
t.references :donor,
|
11
10
|
null: false,
|
12
11
|
index: { name: 'donor_on_donation_indx' },
|
@@ -4,6 +4,10 @@ class CreateCatsCoreProjects < ActiveRecord::Migration[7.0]
|
|
4
4
|
t.string :code, unique: true
|
5
5
|
t.string :description
|
6
6
|
t.references :source, polymorphic: true
|
7
|
+
t.references :program,
|
8
|
+
null: false,
|
9
|
+
index: { name: 'program_on_projects_indx' },
|
10
|
+
foreign_key: { to_table: :cats_core_programs }
|
7
11
|
t.integer :year, null: false
|
8
12
|
t.string :implementing_agency, null: false
|
9
13
|
|
data/lib/cats/core/version.rb
CHANGED