active_record_upsert 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -1
- data/README.md +4 -1
- data/lib/active_record_upsert/active_record/transactions.rb +13 -0
- data/lib/active_record_upsert/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 829a433b3ee06729ebc770faa315c2b6fa7a0fbd
|
4
|
+
data.tar.gz: 36259382b3abcb4b91ea4acab61841cbb2df0d79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c39b53f25dace28627ef418b09558f425f36dd7ef4bb0ef0480fb44dc6229d6087b0f084025f2063abdaf18d539412d69e9a81c24109657f1688dc658d03158
|
7
|
+
data.tar.gz: 856edaa5d0e708521539ecc3255da261ac44a6ecf308b34c4dc9f6d7e81f3076f0e23f67956d6b35f84c90210e885ede94e1c83c61c7c17435d5ab08e770b730
|
data/Gemfile
CHANGED
@@ -3,7 +3,10 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in active_record_upsert.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'activerecord-jdbc-adapter',
|
6
|
+
gem 'activerecord-jdbc-adapter',
|
7
|
+
github: 'jensnockert/activerecord-jdbc-adapter',
|
8
|
+
branch: 'activerecord-50',
|
9
|
+
platform: :jruby
|
7
10
|
|
8
11
|
gem 'activerecord-jdbcpostgresql-adapter',
|
9
12
|
github: 'jensnockert/activerecord-jdbc-adapter',
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/jesjos/active_record_upsert.svg?branch=master)](https://travis-ci.org/jesjos/active_record_upsert)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/jesjos/active_record_upsert/badges/gpa.svg)](https://codeclimate.com/github/jesjos/active_record_upsert)
|
3
|
+
|
1
4
|
# ActiveRecordUpsert
|
2
5
|
|
3
|
-
Real upsert for PostgreSQL 9.5+ and ActiveRecord. Uses ON CONFLICT DO UPDATE.
|
6
|
+
Real upsert for PostgreSQL 9.5+ and ActiveRecord. Uses [ON CONFLICT DO UPDATE](http://www.postgresql.org/docs/9.5/static/sql-insert.html).
|
4
7
|
|
5
8
|
## Main points
|
6
9
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ActiveRecordUpsert
|
2
|
+
module ActiveRecord
|
3
|
+
module TransactionsExtensions
|
4
|
+
def upsert(*args)
|
5
|
+
rollback_active_record_state! do
|
6
|
+
with_transaction_returning_status { super }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
::ActiveRecord::Base.prepend(TransactionsExtensions)
|
12
|
+
end
|
13
|
+
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesper Josefsson
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/active_record_upsert/active_record/persistence.rb
|
146
146
|
- lib/active_record_upsert/active_record/relation.rb
|
147
147
|
- lib/active_record_upsert/active_record/timestamp.rb
|
148
|
+
- lib/active_record_upsert/active_record/transactions.rb
|
148
149
|
- lib/active_record_upsert/arel.rb
|
149
150
|
- lib/active_record_upsert/arel/crud.rb
|
150
151
|
- lib/active_record_upsert/arel/insert_manager.rb
|