logeater 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d01913e98d5c304f6b0da4fc12047db5b3b1d4b
4
- data.tar.gz: 940ce7efd3447ee4ccc8848f4ba3415e3ef3a3ff
3
+ metadata.gz: ee9771f19fbb6a41d6a072d2f1a1fb8280cdcce7
4
+ data.tar.gz: 2b82746a2c79e407ef544a1472ad31826a9f2587
5
5
  SHA512:
6
- metadata.gz: 9b5febf8c5402b3f3581d69479f35417eab7f1ae4d72e8e1faf517bf06d0d0cd976e88c3b8774926104a3681ff03c89d7ee4d0c3c402e2a5d7c9c3c02d5b9b53
7
- data.tar.gz: 5bb72ddf33e312d3c21d284a03619d6e9c25e88a13bab7807779724bb4b3fa4a8b5955fb76be068dfc4915d59f9e549d99320ef0bcdf7efee9a6f36f9e3be1df
6
+ metadata.gz: da4a22896028c127870e05217d3c9125dc73ddc9e28b00afa4dea52d8dca980240ace54dba9f1aaf08d0a628aff861e423957f5080b5774a627a30db7653cdea
7
+ data.tar.gz: d12c10c9df5a1a26fc1bcc36adfc8fb276046c43ef23bfc469057de9c72f8e7759305c53f576678667ecdaf3a452019289001f7cf9b78b53246122a2b8993f7c
@@ -5,5 +5,18 @@ module Logeater
5
5
  class Request < ActiveRecord::Base
6
6
  self.table_name = "requests"
7
7
 
8
+ def self.import(values)
9
+ # values have to be unique by uuid
10
+ values = values.uniq { |request| request.uuid }
11
+
12
+ super values
13
+ rescue PG::UniqueViolation, ActiveRecord::RecordNotUnique
14
+ # try again after skipping requests with existing uuids
15
+ existing_uuids = where(uuid: values.map(&:uuid)).pluck(:uuid)
16
+ values = values.reject { |request| existing_uuids.member?(request.uuid) }
17
+
18
+ super values
19
+ end
20
+
8
21
  end
9
22
  end
@@ -1,3 +1,3 @@
1
1
  module Logeater
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logeater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord