aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-08-14 11:27:40 -0700
committerYves Senn <yves.senn@gmail.com>2013-08-14 11:27:40 -0700
commita4d4af4083d4b41c348f7e707874aedfa1d8a3cd (patch)
treea995d1c82062e245e4dae5ff62a71681e2329318 /activerecord/lib
parentf04b75f5b7b07d4ad4ad58dba01a5493f3198ab6 (diff)
parent0aa95a71b04f2893921c58a7c1d9fca60dbdcbc2 (diff)
downloadrails-a4d4af4083d4b41c348f7e707874aedfa1d8a3cd.tar.gz
rails-a4d4af4083d4b41c348f7e707874aedfa1d8a3cd.tar.bz2
rails-a4d4af4083d4b41c348f7e707874aedfa1d8a3cd.zip
Merge pull request #11574 from jetthoughts/11552_rescue_on_invalid_inet_assign
Fix assign ip address with invalid values raise exception
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/cast.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
index 56dc9ea813..ef7b976d4f 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
@@ -100,7 +100,11 @@ module ActiveRecord
if string.nil?
nil
elsif String === string
- IPAddr.new(string)
+ begin
+ IPAddr.new(string)
+ rescue ArgumentError
+ nil
+ end
else
string
end