activerecord-database_validations 1.0.0 → 1.0.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37d43982bebae9ffbb5ee96d8ae1081c183ae36c
|
4
|
+
data.tar.gz: 90a3f5256fd0f522444cb457ebea9c9d88a3c6c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a2a4c0729fd1b7c9653bc4e83fc111a57fd910c9652a763ac8597ad970f888f0ac2612ef01a981747b0724890ca70321f5920b574521f2932fbc5a08f3868ea
|
7
|
+
data.tar.gz: 7a7f892f2b354b3786bc0aa1ea07419c5094ee7d34806a1879aa6ffdab2a3d5cc78c810195ffb2c6abbf59a2823d0164f9183b5ff97816cb1076a91aa40ce642
|
@@ -5,8 +5,10 @@ module ActiveRecord::DatabaseValidations::Validations
|
|
5
5
|
validates_database_foreign_key
|
6
6
|
end
|
7
7
|
|
8
|
+
NOT_NULL_IGNORED = ['created_at', 'updated_at']
|
8
9
|
def validates_database_not_null(options = {})
|
9
10
|
columns.reject(&:null).each do |column|
|
11
|
+
next if NOT_NULL_IGNORED.include?(column.name)
|
10
12
|
validation = proc do
|
11
13
|
if self[column.name].nil?
|
12
14
|
errors.add(column.name, options[:message] || :blank)
|