active_record_upsert 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: de123fd4fdfdb6a7cbebd1aa2d7232ecfdebf014723e4b64c7e0ad3a8c8f61b4
4
- data.tar.gz: 27d972189bb6e75c48eb43cc7cb93362991ad237ffe84a25349fe148b648187b
2
+ SHA1:
3
+ metadata.gz: 70b72c5ef238f1ffe3f7cfd5e2cc53f3b4c9e31f
4
+ data.tar.gz: '09bfa1ad9bf6e4ea635371382d1b8e02f5fe8fb0'
5
5
  SHA512:
6
- metadata.gz: c33829cb05d8c261c850e3dcde28842cd50824369231c58b936c30bf6ddae64fb76c68ec594e4e62f4578eb4940d51d23033056a31bfeea2da4e4ad821e14070
7
- data.tar.gz: f8943ad447f87aa33b8ae4facdfda3ae7368c8d3e9b3c7bfc1985ddfd97dd2654670620ed803ed52f38034c6c4bc7a49fdc0d8135be83f16504b2efcdb59ed50
6
+ metadata.gz: 2e75ee846435aeb19b077eb34d844345d86d04374b9bdfb09d5311b3fea00c029dc8acd590b61541186d38efa907166df01faaeffcf9bae022e6116ef3baa405
7
+ data.tar.gz: 2b2b56642038a8c350bfd6d7cc8a6d5bd1349e353b69b206509ffe68b1e716b95e23e2c71a4c5f2ccdda13b541f1152d69167da1bd6ba07f9fd054daee936430
@@ -0,0 +1,5 @@
1
+ group :development, :test do
2
+ gem 'rails', '>= 6.0.0.rc1', '< 6.1'
3
+ end
4
+
5
+ eval_gemfile "#{__dir__}/Gemfile.base"
data/README.md CHANGED
@@ -2,9 +2,6 @@
2
2
  [![Build Status](https://travis-ci.org/jesjos/active_record_upsert.svg?branch=master)](https://travis-ci.org/jesjos/active_record_upsert)
3
3
  [![Code Climate](https://codeclimate.com/github/jesjos/active_record_upsert/badges/gpa.svg)](https://codeclimate.com/github/jesjos/active_record_upsert)
4
4
 
5
- # NB: INCOMPATIBILITY
6
- B/c of a broken build matrix, versions 0.9.2 - 0.9.3 are incompatible with rails < 5.2.1!
7
-
8
5
  # ActiveRecordUpsert
9
6
 
10
7
  Real upsert for PostgreSQL 9.5+ and Rails 5 / ActiveRecord 5. Uses [ON CONFLICT DO UPDATE](http://www.postgresql.org/docs/9.5/static/sql-insert.html).
@@ -17,12 +14,17 @@ Real upsert for PostgreSQL 9.5+ and Rails 5 / ActiveRecord 5. Uses [ON CONFLICT
17
14
 
18
15
  ## Prerequisites
19
16
 
20
- - PostgreSQL 9.5+
17
+ - PostgreSQL 9.5+ (that's when UPSERT support was added; see Wikipedia's [PostgreSQL Release History](https://en.wikipedia.org/wiki/PostgreSQL#Release_history))
21
18
  - ActiveRecord ~> 5
22
19
  - For MRI: pg
23
20
 
24
21
  - For JRuby: No support
25
22
 
23
+ ### NB: Releases to avoid
24
+
25
+ Due to a broken build matrix, v0.9.2 and v0.9.3 are incompatible with Rails
26
+ < 5.2.1. [v0.9.4](https://github.com/jesjos/active_record_upsert/releases/tag/v0.9.4) fixed this issue.
27
+
26
28
  ## Installation
27
29
 
28
30
  Add this line to your application's Gemfile:
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.platform = Gem::Platform::RUBY
23
23
 
24
- spec.add_runtime_dependency 'activerecord', '>= 5.0', '< 6.0'
25
- spec.add_runtime_dependency 'arel', '> 7.0', '< 10.0'
24
+ spec.add_runtime_dependency 'activerecord', '>= 5.0', '< 6.1'
26
25
  spec.add_runtime_dependency 'pg', '>= 0.18', '< 2.0'
27
26
  end
@@ -13,6 +13,7 @@ require 'active_record_upsert/active_record'
13
13
 
14
14
  version = defined?(Rails) ? Rails.version : ActiveRecord.version.to_s
15
15
 
16
+ require 'active_record_upsert/compatibility/rails60.rb' if version >= '6.0.0' && version < '6.1.0'
16
17
  require 'active_record_upsert/compatibility/rails51.rb' if version >= '5.1.0' && version < '5.2.0'
17
18
  require 'active_record_upsert/compatibility/rails50.rb' if version >= '5.0.0' && version < '5.1.0'
18
19
 
@@ -25,7 +25,8 @@ module ActiveRecordUpsert
25
25
  end
26
26
 
27
27
  def _upsert_record(upsert_attribute_names = changed, arel_condition = nil)
28
- existing_attributes = attributes_with_values_for_create(self.attributes.keys)
28
+ existing_attribute_names = attributes_for_create(attributes.keys)
29
+ existing_attributes = attributes_with_values(existing_attribute_names)
29
30
  values = self.class._upsert_record(existing_attributes, upsert_attribute_names, [arel_condition].compact)
30
31
  @attributes = self.class.attributes_builder.build_from_database(values.first.to_h)
31
32
  @new_record = false
@@ -0,0 +1,9 @@
1
+ module ActiveRecordUpsert
2
+ module ActiveRecord
3
+ module TransactionsExtensions
4
+ def upsert(*args)
5
+ with_transaction_returning_status { super }
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordUpsert
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_upsert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesper Josefsson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-09-19 00:00:00.000000000 Z
12
+ date: 2019-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '5.0'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '6.0'
23
+ version: '6.1'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,27 +30,7 @@ dependencies:
30
30
  version: '5.0'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
34
- - !ruby/object:Gem::Dependency
35
- name: arel
36
- requirement: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">"
39
- - !ruby/object:Gem::Version
40
- version: '7.0'
41
- - - "<"
42
- - !ruby/object:Gem::Version
43
- version: '10.0'
44
- type: :runtime
45
- prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ">"
49
- - !ruby/object:Gem::Version
50
- version: '7.0'
51
- - - "<"
52
- - !ruby/object:Gem::Version
53
- version: '10.0'
33
+ version: '6.1'
54
34
  - !ruby/object:Gem::Dependency
55
35
  name: pg
56
36
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +63,7 @@ files:
83
63
  - Gemfile.rails-5-0
84
64
  - Gemfile.rails-5-1
85
65
  - Gemfile.rails-5-2
66
+ - Gemfile.rails-6-0
86
67
  - Gemfile.rails-master
87
68
  - LICENSE
88
69
  - README.md
@@ -109,6 +90,7 @@ files:
109
90
  - lib/active_record_upsert/arel/visitors/to_sql.rb
110
91
  - lib/active_record_upsert/compatibility/rails50.rb
111
92
  - lib/active_record_upsert/compatibility/rails51.rb
93
+ - lib/active_record_upsert/compatibility/rails60.rb
112
94
  - lib/active_record_upsert/version.rb
113
95
  homepage: https://github.com/jesjos/active_record_upsert/
114
96
  licenses:
@@ -130,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
112
  version: '0'
131
113
  requirements: []
132
114
  rubyforge_project:
133
- rubygems_version: 2.7.7
115
+ rubygems_version: 2.6.14.4
134
116
  signing_key:
135
117
  specification_version: 4
136
118
  summary: Real PostgreSQL 9.5+ upserts using ON CONFLICT for ActiveRecord