unit_validation 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/unit_validation.rb +2 -1
- data/lib/unit_validation/version.rb +1 -1
- data/test/dummy/log/test.log +17 -0
- metadata +4 -4
data/lib/unit_validation.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class UnitValidator < ActiveModel::EachValidator
|
2
|
+
require 'ruby-units'
|
2
3
|
def validate_each(record, attribute, value)
|
3
4
|
allowed=Array(options[:allowed_types]) if options[:allowed_types]
|
4
5
|
begin
|
@@ -12,4 +13,4 @@ class UnitValidator < ActiveModel::EachValidator
|
|
12
13
|
record.errors[attribute] << (options[:message] || "is not a valid measurement")
|
13
14
|
end
|
14
15
|
end
|
15
|
-
end
|
16
|
+
end
|
data/test/dummy/log/test.log
CHANGED
@@ -180,3 +180,20 @@ Connecting to database specified by database.yml
|
|
180
180
|
[1m[35m (0.0ms)[0m rollback transaction
|
181
181
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
182
182
|
[1m[35m (0.0ms)[0m rollback transaction
|
183
|
+
Connecting to database specified by database.yml
|
184
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
185
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
186
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
187
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
188
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
189
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
190
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
191
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
192
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
193
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
194
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
195
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
196
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
197
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
198
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
199
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unit_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: -3016504596751154144
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
segments:
|
136
136
|
- 0
|
137
|
-
hash:
|
137
|
+
hash: -3016504596751154144
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
140
|
rubygems_version: 1.8.21
|