can_has_validations 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a473e81111cafcc6b4d223880caad7052942be2a
|
4
|
+
data.tar.gz: f115deab48a5d436d8c920226aa1ff1ff98be0fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfdf907a40155f1ed52938d83ec9b1ce1b1e58f8091ba90857210ac2596d058746e4563a0aaee7c2f9b51380471120b698558541e8042d88d5f617743c04a14e
|
7
|
+
data.tar.gz: e6525ec77bd6550b54de3793be89e2e5562934aac4ad06d3c2688e3f3a1fda8abeba12f7e7089a46bbf5497908f8cda7751a993834b52be94c88def415c0b008
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Validations provided:
|
|
12
12
|
* URL
|
13
13
|
* Write Once
|
14
14
|
|
15
|
-
All validators use the newer Rails 3 syntax:
|
15
|
+
All validators use the newer Rails 3+ syntax:
|
16
16
|
|
17
17
|
validates :some_attribute, email: true
|
18
18
|
|
@@ -174,4 +174,4 @@ Default messages are as follows:
|
|
174
174
|
|
175
175
|
## Compatibility ##
|
176
176
|
|
177
|
-
Tested with Ruby 1
|
177
|
+
Tested with Ruby 2.1 and ActiveSupport and ActiveModel 4.2.
|
@@ -35,26 +35,4 @@ module ActiveModel::Validations
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
# class OrderingValidator < ActiveModel::EachValidator
|
39
|
-
# def validate_each(record, attribute, value)
|
40
|
-
# Array(options[:before]).each do |attr_name|
|
41
|
-
# greater = record.send attr_name
|
42
|
-
# next unless value && greater
|
43
|
-
# unless value < greater
|
44
|
-
# attr2 = record.class.human_attribute_name attr_name
|
45
|
-
# record.errors.add(attribute, :before, options.except(:before).merge!(:attribute2=>attr2))
|
46
|
-
# # record.errors[attribute] << (options[:message] || :before"must be before #{record.class.human_attribute_name attr_name}")
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# Array(options[:after]).each do |attr_name|
|
50
|
-
# lesser = record.send attr_name
|
51
|
-
# next unless value && lesser
|
52
|
-
# unless value > lesser
|
53
|
-
# attr2 = record.class.human_attribute_name attr_name
|
54
|
-
# record.errors.add(attribute, :after, options.except(:after).merge!(:attribute2=>attr2))
|
55
|
-
# # record.errors[attribute] << (options[:message] || :after"must be after #{record.class.human_attribute_name attr_name}")
|
56
|
-
# end
|
57
|
-
# end
|
58
|
-
# end
|
59
|
-
# end
|
60
38
|
end
|
@@ -7,10 +7,11 @@ module ActiveModel::Validations
|
|
7
7
|
def validate_each(record, attribute, value)
|
8
8
|
if defined?(Addressable::URI)
|
9
9
|
u = Addressable::URI.parse(value) rescue nil
|
10
|
+
u2 = u && URI.parse(u.normalize.to_s) rescue nil
|
10
11
|
else
|
11
|
-
u = URI.parse(value) rescue nil
|
12
|
+
u2 = u = URI.parse(value) rescue nil
|
12
13
|
end
|
13
|
-
if !u || u.relative? || %w(http https).exclude?(u.scheme)
|
14
|
+
if !u || !u2 || u.relative? || %w(http https).exclude?(u.scheme)
|
14
15
|
record.errors.add(attribute, :invalid_url, options)
|
15
16
|
end
|
16
17
|
end
|
metadata
CHANGED
@@ -1,52 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: can_has_validations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- thomas morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.0'
|
22
|
-
- - <
|
20
|
+
- - "<"
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: '5.0'
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '3.0'
|
33
|
-
- - <
|
30
|
+
- - "<"
|
34
31
|
- !ruby/object:Gem::Version
|
35
32
|
version: '5.0'
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: sqlite3
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
|
-
- -
|
37
|
+
- - ">="
|
42
38
|
- !ruby/object:Gem::Version
|
43
39
|
version: '0'
|
44
40
|
type: :development
|
45
41
|
prerelease: false
|
46
42
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
43
|
requirements:
|
49
|
-
- -
|
44
|
+
- - ">="
|
50
45
|
- !ruby/object:Gem::Version
|
51
46
|
version: '0'
|
52
47
|
description: Assorted Rails 3.x-4.x validators.
|
@@ -56,6 +51,10 @@ executables: []
|
|
56
51
|
extensions: []
|
57
52
|
extra_rdoc_files: []
|
58
53
|
files:
|
54
|
+
- MIT-LICENSE
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- lib/can_has_validations.rb
|
59
58
|
- lib/can_has_validations/locale/en.yml
|
60
59
|
- lib/can_has_validations/validators/email_validator.rb
|
61
60
|
- lib/can_has_validations/validators/existence_validator.rb
|
@@ -65,17 +64,16 @@ files:
|
|
65
64
|
- lib/can_has_validations/validators/url_validator.rb
|
66
65
|
- lib/can_has_validations/validators/write_once_validator.rb
|
67
66
|
- lib/can_has_validations/version.rb
|
68
|
-
- lib/can_has_validations.rb
|
69
67
|
- lib/tasks/can_has_validations_tasks.rake
|
70
|
-
- MIT-LICENSE
|
71
|
-
- Rakefile
|
72
|
-
- README.md
|
73
68
|
- test/can_has_validations_test.rb
|
69
|
+
- test/dummy/README.rdoc
|
70
|
+
- test/dummy/Rakefile
|
74
71
|
- test/dummy/app/assets/javascripts/application.js
|
75
72
|
- test/dummy/app/assets/stylesheets/application.css
|
76
73
|
- test/dummy/app/controllers/application_controller.rb
|
77
74
|
- test/dummy/app/helpers/application_helper.rb
|
78
75
|
- test/dummy/app/views/layouts/application.html.erb
|
76
|
+
- test/dummy/config.ru
|
79
77
|
- test/dummy/config/application.rb
|
80
78
|
- test/dummy/config/boot.rb
|
81
79
|
- test/dummy/config/database.yml
|
@@ -91,44 +89,34 @@ files:
|
|
91
89
|
- test/dummy/config/initializers/wrap_parameters.rb
|
92
90
|
- test/dummy/config/locales/en.yml
|
93
91
|
- test/dummy/config/routes.rb
|
94
|
-
- test/dummy/config.ru
|
95
92
|
- test/dummy/public/404.html
|
96
93
|
- test/dummy/public/422.html
|
97
94
|
- test/dummy/public/500.html
|
98
95
|
- test/dummy/public/favicon.ico
|
99
|
-
- test/dummy/Rakefile
|
100
|
-
- test/dummy/README.rdoc
|
101
96
|
- test/dummy/script/rails
|
102
97
|
- test/test_helper.rb
|
103
98
|
homepage: https://github.com/zarqman/can_has_validations
|
104
99
|
licenses: []
|
100
|
+
metadata: {}
|
105
101
|
post_install_message:
|
106
102
|
rdoc_options: []
|
107
103
|
require_paths:
|
108
104
|
- lib
|
109
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
106
|
requirements:
|
112
|
-
- -
|
107
|
+
- - ">="
|
113
108
|
- !ruby/object:Gem::Version
|
114
109
|
version: '0'
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
hash: 1561707028780801012
|
118
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
111
|
requirements:
|
121
|
-
- -
|
112
|
+
- - ">="
|
122
113
|
- !ruby/object:Gem::Version
|
123
114
|
version: '0'
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
hash: 1561707028780801012
|
127
115
|
requirements: []
|
128
116
|
rubyforge_project:
|
129
|
-
rubygems_version:
|
117
|
+
rubygems_version: 2.4.3
|
130
118
|
signing_key:
|
131
|
-
specification_version:
|
119
|
+
specification_version: 4
|
132
120
|
summary: Assorted Rails 3.x-4.x validators
|
133
121
|
test_files:
|
134
122
|
- test/can_has_validations_test.rb
|