mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
URGENT FIX: code would fail in Ruby 1.9.3 exception does not exist
This commit is contained in:
@@ -19,7 +19,10 @@ class ScreenedIpAddress < ActiveRecord::Base
|
||||
# inet/cidr columns:
|
||||
def ip_address=(val)
|
||||
write_attribute(:ip_address, val)
|
||||
rescue IPAddr::InvalidAddressError
|
||||
|
||||
# this gets even messier, Ruby 1.9.2 raised a different exception to Ruby 2.0.0
|
||||
# handle both exceptions
|
||||
rescue ArgumentError, IPAddr::InvalidAddressError
|
||||
self.errors.add(:ip_address, :invalid)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user