Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1615280
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
Sat, Mar 21, 10:09 PM
Size
303 B
Mime Type
text/x-ruby
Expires
Mon, Mar 23, 10:09 PM (23 h, 19 m)
Engine
blob
Format
Raw Data
Handle
353882
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