subj_sub_models 0.0.3.24 → 0.0.3.25

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
  SHA1:
3
- metadata.gz: f05992968b186c1dc23466805ce8f117d5e23dc4
4
- data.tar.gz: a823128dd109ec4faf965d2e6b3ead7d7ac744b6
3
+ metadata.gz: 52816493b98dd3e9d4521321b876515ee553b7c6
4
+ data.tar.gz: bea5b8ed8c0f9f3f9df4657829aa7fb2929fc0b2
5
5
  SHA512:
6
- metadata.gz: 891955f5bbad8f3a630bc56ff94503639d6773d70b82ef73ad59f3c2d986d6a27922d5d8da1a4b9da09d8c477fd8c632561ff04368de80978a83f68c1dcd5401
7
- data.tar.gz: 76e5e0a178330a80b7f0834bfd515c6e74fed32e88db89bdfb5d732a20fc63673dba9b9bf99e3b4c12bd36af45ca59ba95030a98ff4c4f9e803516837f0011fa
6
+ metadata.gz: da355780261d61bfb6cf5675a44505028bc0233d19645afa683abe5687cc4de8fe6170c02e221a338e4e20d1d468cd752b7d7a8bca4347801da8803849a5b9d6
7
+ data.tar.gz: c1a2b7f9c03d35219fe1aca9827fb19992e12165829432ed066618f6a7f0ac452f18123d2b721c084a94cef7a06e9312db63d4864046d2814337cd44da43bb6f
@@ -21,12 +21,20 @@ module SubjModels
21
21
 
22
22
  validates :current_price, presence: true
23
23
 
24
+ after_create :update_nomenclature_availability
25
+
24
26
  scope :nomenclature_id, -> (nomenclature_id) { parent_id_scope("nomenclature", nomenclature_id) }
25
27
 
26
28
  scope :belongs_to_nomenclature, -> (nomenclature_id) do
27
29
  where(nomenclature_id: nomenclature_id).union(joins(:nomenclature_variety).where("nomenclature_varieties.nomenclature_id" => nomenclature_id))
28
30
  end
29
31
 
32
+ def update_nomenclature_availability
33
+ if quality && nomenclature
34
+ quality.is_stock ? nomenclature.is_available_for_stock = true : nomenclature.is_available = true
35
+ end
36
+ end
37
+
30
38
  end
31
39
 
32
40
  end
@@ -1,3 +1,3 @@
1
1
  module SubjModels
2
- VERSION = '0.0.3.24'
2
+ VERSION = '0.0.3.25'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subj_sub_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.24
4
+ version: 0.0.3.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.Nasa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler