Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F2569686
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
Wed, Jun 10, 6:42 PM
Size
303 B
Mime Type
text/x-ruby
Expires
Fri, Jun 12, 6:42 PM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
375576
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