morse_fields_validator 1.0.1 → 1.1.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 480146ad3c18a4216a22a2ee7dde7fb982b591fc
|
4
|
+
data.tar.gz: 15c5cbb863e93f848a2b6df97a814d4f2126a78c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1813a4f7e25ea9d86a5c21f766f291590a4eb344c61d167b7f1c0ff3a6b4ee7900c076a123028d31aa77cd5539c1488e30b1e542fab739aca03043b5d17732c3
|
7
|
+
data.tar.gz: 5eedb850fdacb13cc7f61347e15f0605957f437c96b61b73a3aaf4393cc097bd24a2b2b242719dc9e2353cd1c0d779b31de81eeba998d1867f7ba5597124dc38
|
@@ -10,24 +10,21 @@ module FieldsValidator
|
|
10
10
|
def validate_required_attributes
|
11
11
|
required_attributes.each do |a|
|
12
12
|
validates a.to_sym, presence: true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
def load_required_attributes(*_attrs)
|
16
|
-
@required_attributes=_attrs.any? ? _attrs : []
|
17
|
-
@required_attributes.uniq!
|
13
|
+
end if required_attributes.any?
|
18
14
|
end
|
19
15
|
|
20
16
|
def required_attributes
|
21
|
-
|
17
|
+
defined?(super) ? super : []
|
22
18
|
end
|
23
|
-
end
|
24
19
|
|
25
|
-
|
20
|
+
def required_database_fields
|
21
|
+
defined?(super) ? super : []
|
22
|
+
end
|
26
23
|
|
27
|
-
def required_database_fields
|
28
|
-
defined?(super) ? super : []
|
29
24
|
end
|
30
25
|
|
26
|
+
private
|
27
|
+
|
31
28
|
def validate_column_names
|
32
29
|
required_database_fields.each { |rdf| errors_add(rdf, "does not have a column in the database.") unless self.class.column_names.include?(rdf)} if required_database_fields.any?
|
33
30
|
end
|