Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F905144
not_ip_validator.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Aug 29, 9:30 PM
Size
303 B
Mime Type
text/x-ruby
Expires
Sun, Aug 31, 9:30 PM (9 h, 30 m)
Engine
blob
Format
Raw Data
Handle
252501
Attached To
rWEBDNS WebDNS (edet4)
not_ip_validator.rb
View Options
class
NotIpValidator
<
ActiveModel
::
EachValidator
# Add an Atribute error if this a valid IP address.
def
validate_each
(
record
,
attribute
,
value
)
if
[
Ipv4Validator
,
Ipv6Validator
].
any?
{
|
fam
|
fam
.
valid?
(
value
)
}
record
.
errors
[
attribute
]
<<
'should not be an IP address'
end
end
end
Event Timeline
Log In to Comment