database_validations 0.8.3 → 0.8.4

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: 56c892c79d9621f4bd44320198ddc1a982a45f5e8c03099cb8ce50bff1292983
4
- data.tar.gz: '09c4a8c5cd90672af903a20c6608d22a019cf252fc2ebe7ad324abfe70b3fa32'
3
+ metadata.gz: ef7ec227437ca99440f72837a6dfe1d3fa21416ade5bcf60b2e3780037fae6af
4
+ data.tar.gz: 6e8a592f0884396b80b33d001c9194d9d97c1e78c14b099d66c140dee266edd7
5
5
  SHA512:
6
- metadata.gz: e5435113bf31727fc907ddb1d4ac38534f36e6a2f8d410c14b90e8b3fa589dc630b5620aedb4043606c653d575808f530e0d265360b9588965df4b0d43b74679
7
- data.tar.gz: 5edde842f3003a572f8cf89ca69d025261b8ed277c61fa992abc6338c6de6ea1adb9d64f7946550a443c154c94de555921e8c77378f44308a6508fa1bfad4aab
6
+ metadata.gz: 642ee70b3bdb810e06adeb4ebcf0e285ba5487a76ee5a8990cec6656e0f90ee3f27f8daf02402664addeaafabf592b0b8d68a339ab21dcda052b6d6b82fb2d81
7
+ data.tar.gz: f34ade4123b89869f946da93c334e713e575eeb6b2b6908faefe38007f6c241854a512222e3f64caba2ae945c8001b5e22dd65d7ebe385fbfe738e2e2d85ff14
@@ -7,7 +7,7 @@ module DatabaseValidations
7
7
 
8
8
  validate do
9
9
  Helpers.each_belongs_to_presence_validator(self.class) do |validator|
10
- next unless validator.column_and_relation_nil_for?(self)
10
+ next unless validator.column_and_relation_blank_for?(self)
11
11
 
12
12
  errors.add(validator.relation, :blank, message: :required)
13
13
  end
@@ -18,7 +18,7 @@ module DatabaseValidations
18
18
  output = super(context)
19
19
 
20
20
  Helpers.each_belongs_to_presence_validator(self.class) do |validator|
21
- next if validator.column_and_relation_nil_for?(self)
21
+ next if validator.column_and_relation_blank_for?(self)
22
22
 
23
23
  validates_with(ActiveRecord::Validations::PresenceValidator, validator.validates_presence_options)
24
24
  end
@@ -43,7 +43,7 @@ module DatabaseValidations
43
43
  private
44
44
 
45
45
  def perform_validations(options = {})
46
- options[:validate] == false || valid_without_database_validations(options[:context])
46
+ options[:validate] == false || valid_without_database_validations?(options[:context])
47
47
  end
48
48
  end
49
49
 
@@ -17,8 +17,8 @@ module DatabaseValidations
17
17
  end
18
18
 
19
19
  # @return [Boolean]
20
- def column_and_relation_nil_for?(instance)
21
- instance.public_send(column).nil? && instance.public_send(relation).nil?
20
+ def column_and_relation_blank_for?(instance)
21
+ instance.public_send(column).blank? && instance.public_send(relation).blank?
22
22
  end
23
23
 
24
24
  def handle_foreign_key_error(instance)
@@ -35,7 +35,7 @@ module DatabaseValidations
35
35
  private
36
36
 
37
37
  def perform_validations(options = {})
38
- options[:validate] == false || valid_without_database_validations(options[:context])
38
+ options[:validate] == false || valid_without_database_validations?(options[:context])
39
39
  end
40
40
  end
41
41
 
@@ -3,7 +3,7 @@ module DatabaseValidations
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- alias_method :valid_without_database_validations, :valid?
6
+ alias_method :valid_without_database_validations?, :valid?
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module DatabaseValidations
2
- VERSION = '0.8.3'.freeze
2
+ VERSION = '0.8.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-05 00:00:00.000000000 Z
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord