validation_hints 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/active_model/hints.rb +4 -0
- data/lib/validation_hints.rb +17 -5
- data/lib/validation_hints/version.rb +1 -1
- metadata +1 -1
data/lib/active_model/hints.rb
CHANGED
data/lib/validation_hints.rb
CHANGED
@@ -7,16 +7,28 @@ module ActiveModel
|
|
7
7
|
|
8
8
|
module Validations
|
9
9
|
|
10
|
+
module ClassMethods
|
11
|
+
|
12
|
+
def has_validations?
|
13
|
+
! self.validators.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def has_validations_for?(attribute)
|
17
|
+
! self.validators_on(attribute).empty?
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
10
22
|
def has_validations?
|
11
|
-
|
23
|
+
self.class.has_validations?
|
12
24
|
end
|
13
25
|
|
14
|
-
def
|
15
|
-
|
26
|
+
def has_validations_for?(attribute)
|
27
|
+
self.class.has_validations_for?(attribute)
|
16
28
|
end
|
17
29
|
|
18
|
-
def
|
19
|
-
hints.
|
30
|
+
def hints
|
31
|
+
@hints ||= Hints.new(self)
|
20
32
|
end
|
21
33
|
|
22
34
|
end
|