Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F449151
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
Thu, Apr 24, 3:35 PM
Size
303 B
Mime Type
text/x-ruby
Expires
Sat, Apr 26, 3:35 PM (1 d, 16 h)
Engine
blob
Format
Raw Data
Handle
212392
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