sexy_validations 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sexy_validations.rb +5 -5
- data/sexy_validations.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/lib/sexy_validations.rb
CHANGED
@@ -10,7 +10,7 @@ module SexyValidations
|
|
10
10
|
|
11
11
|
def self.included(klass)
|
12
12
|
klass.instance_eval do
|
13
|
-
|
13
|
+
class_attribute :validations
|
14
14
|
self.validations = []
|
15
15
|
|
16
16
|
extend ClassMethods
|
@@ -62,7 +62,7 @@ module SexyValidations
|
|
62
62
|
unless validations.blank?
|
63
63
|
validations.each_pair do |validator, options|
|
64
64
|
klass = load_validator(validator)
|
65
|
-
self.validations
|
65
|
+
self.validations += {
|
66
66
|
:attribute => attribute,
|
67
67
|
:validator => klass,
|
68
68
|
:options => options,
|
@@ -72,14 +72,14 @@ module SexyValidations
|
|
72
72
|
end
|
73
73
|
else
|
74
74
|
if attribute
|
75
|
-
self.validations
|
75
|
+
self.validations += {
|
76
76
|
:method => "#{attribute}_validation",
|
77
77
|
:conditions => conditions,
|
78
78
|
:conditions_if => conditions_if,
|
79
79
|
}
|
80
80
|
else
|
81
81
|
raise ArgumentError, "at least a block has to be given" unless block_given?
|
82
|
-
self.validations
|
82
|
+
self.validations += {
|
83
83
|
:block => block,
|
84
84
|
:conditions => conditions,
|
85
85
|
:conditions_if => conditions_if,
|
@@ -93,7 +93,7 @@ module SexyValidations
|
|
93
93
|
def validate!
|
94
94
|
errors.clear
|
95
95
|
validations.each do |validation|
|
96
|
-
catch
|
96
|
+
catch(:skip_validation) do
|
97
97
|
if validation[:conditions]
|
98
98
|
validation[:conditions].each do |condition|
|
99
99
|
success = condition.call(self, validation[:attribute])
|
data/sexy_validations.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sexy_validations}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Corin Langosch"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-24}
|
13
13
|
s.description = %q{Module which provides sexy validations for models.}
|
14
14
|
s.email = %q{info@netskin.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 3
|
9
|
+
version: 0.5.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Corin Langosch
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-24 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|