FIX: catch specific exception

This commit is contained in:
Sam 2014-08-06 10:00:43 +10:00
parent 9dc96d117f
commit b573b3227e
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ class IncomingDomain < ActiveRecord::Base
begin
current = create!(name: name, https: https, port: port)
rescue
rescue ActiveRecord::RecordNotUnique
# duplicate key is just ignored
end

View File

@ -11,8 +11,8 @@ class IncomingReferer < ActiveRecord::Base
begin
current = create!(path: path, incoming_domain_id: domain_id)
rescue
# duplicates
rescue ActiveRecord::RecordNotUnique
# does not matter
end
current || find_by(path: path, incoming_domain_id: domain_id)