inventory_refresh 0.3.1 → 0.3.2

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: b326cffd9bf55a9d960022f65397575975b631ddf00b95bc2b19b520464fec94
4
- data.tar.gz: 97ab5734fe7dcb1782fb1aaac1047f4222d988b028d39b43084b10565b4f88f4
3
+ metadata.gz: b10eefddb6c6047733a621b97d2c70c6d052631bedaf60b2a7576ea6aaa51d14
4
+ data.tar.gz: 0604db9347d58b247ff49a2ce6c0babb18aabec4f83e9229f4dbe128b5274b02
5
5
  SHA512:
6
- metadata.gz: 7f8b0916b49e99eed8c53041a25c828614909b532770dcaff905bbab908c47129a797bb522a6ded215b4ffd7d97e675afde384e0f308d926a848d860da54c0f6
7
- data.tar.gz: 7d42174e2b279952f7e921318697d974db62823066760e62923383fee3c779578935b2489ac51ee26b73a5a56d191298c80a1007213d78069d5bc74e1350d35c
6
+ metadata.gz: 1d8ad459489ab9bccc1b1782c68798002bac2d40efbb3e1f9f1e9b604a68926a48ba9872060c602463b5d874d56cc00e0ce02365a5297b5fa42a1288cd45188a
7
+ data.tar.gz: d2b2524881deed9627a09c39db3265fcfc0bc11e1fdd4efea68a4c841dff3c62b890a12c243226c7419a775128f54808f9ce008f1f0e0661abf0498bc0ca1b1b
@@ -0,0 +1 @@
1
+ * @agrare @Fryguy @Ladas @slemrmartin
@@ -342,13 +342,25 @@ module InventoryRefresh
342
342
  #
343
343
  # @return [Array<Symbol>] attributes that are needed for saving of the record
344
344
  def fixed_attributes
345
+ not_null_attributes = []
346
+
345
347
  if model_class
348
+ # Attrs having presence validator
346
349
  presence_validators = model_class.validators.detect { |x| x.kind_of?(ActiveRecord::Validations::PresenceValidator) }
350
+ not_null_attributes += presence_validators.attributes if presence_validators.present?
351
+
352
+ # Column names having NOT NULL constraint
353
+ non_null_constraints = model_class.columns_hash.values.reject(&:null).map(&:name) - [model_class.primary_key]
354
+ not_null_attributes += non_null_constraints.map(&:to_sym)
355
+
356
+ # Column names having NOT NULL constraint transformed to relation names
357
+ not_null_attributes += non_null_constraints.map {|x| foreign_key_to_association_mapping[x]}.compact
347
358
  end
348
359
  # Attributes that has to be always on the entity, so attributes making unique index of the record + attributes
349
360
  # that have presence validation
361
+
350
362
  fixed_attributes = manager_ref
351
- fixed_attributes += presence_validators.attributes if presence_validators.present?
363
+ fixed_attributes += not_null_attributes.uniq
352
364
  fixed_attributes
353
365
  end
354
366
 
@@ -1,3 +1,3 @@
1
1
  module InventoryRefresh
2
- VERSION = "0.3.1".freeze
2
+ VERSION = "0.3.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inventory_refresh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2020-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -143,6 +143,7 @@ extensions: []
143
143
  extra_rdoc_files: []
144
144
  files:
145
145
  - ".codeclimate.yml"
146
+ - ".github/CODEOWNERS"
146
147
  - ".gitignore"
147
148
  - ".rspec"
148
149
  - ".rspec_ci"
@@ -221,8 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
222
  - !ruby/object:Gem::Version
222
223
  version: '0'
223
224
  requirements: []
224
- rubyforge_project:
225
- rubygems_version: 2.7.6.2
225
+ rubygems_version: 3.1.2
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Topological Inventory Persister