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.
@@ -66,6 +66,10 @@ module ActiveModel
66
66
  result
67
67
  end
68
68
 
69
+ def full_messages_for(attribute)
70
+ hints_for(attribute).map { |message| full_message(attribute, message) }
71
+ end
72
+
69
73
  def initialize_dup(other)
70
74
  @messages = other.messages.dup
71
75
  end
@@ -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
- ! self.class.validators.empty?
23
+ self.class.has_validations?
12
24
  end
13
25
 
14
- def hints
15
- @hints ||= Hints.new(self)
26
+ def has_validations_for?(attribute)
27
+ self.class.has_validations_for?(attribute)
16
28
  end
17
29
 
18
- def hints_for(attribute)
19
- hints.validation_hints_for(attribute)
30
+ def hints
31
+ @hints ||= Hints.new(self)
20
32
  end
21
33
 
22
34
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module ValidationHints
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validation_hints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: