mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
URGENT FIX: code would fail in Ruby 1.9.3 exception does not exist
This commit is contained in:
parent
6eb5f1aec2
commit
1b19444b44
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue