Method: Webhookdb::Postgres::Validations#validates_ip_address
- Defined in:
- lib/webhookdb/postgres/validations.rb
#validates_ip_address(col) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/webhookdb/postgres/validations.rb', line 38 def validates_ip_address(col) return if self[col].respond_to?(:ipv4?) begin IPAddr.new(self[col]) rescue IPAddr::Error self.errors.add(col, "is not a valid INET address") end end |