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 begin
current = create!(name: name, https: https, port: port) current = create!(name: name, https: https, port: port)
rescue rescue ActiveRecord::RecordNotUnique
# duplicate key is just ignored # duplicate key is just ignored
end end

View File

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