mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:43:19 +08:00
URGENT FIX: code would fail in Ruby 1.9.3 exception does not exist
This commit is contained in:
parent
6eb5f1aec2
commit
1b19444b44
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user