trx_ext 1.0.0 → 1.0.3

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
2
  SHA256:
3
- metadata.gz: 0e9808d96281c682d1a21a40f34fedd04c272580fbf23cd5416a28ef0ee6fb1d
4
- data.tar.gz: aa42a719f9fad4a590b66f18a2e764da419c342b67268b545bd7b65001b1aa46
3
+ metadata.gz: a28c9749e98f72553e2ca37963009fcc8ddf841f6930cc7ad6d71ba403650b2c
4
+ data.tar.gz: c45c63fdd16cb43c12d6fa6927e2d66436cb94f7b657062e0c97e92d4671c09e
5
5
  SHA512:
6
- metadata.gz: 5de79266da41bee17a7ab592cfcca4d814d248896c896b622d590fad7f6214caf57d30cfe497f1928f7098e5e5d3e5bda141bd5add11dc5096d78145174e3fdf
7
- data.tar.gz: d7c7e052193e15f0b08e3fbae23d11472dc1abd3cc911761df11742214ec40b67117efe8ea6d731a4479d7d095181a5b1d75170860dc631eec5505df47a590ba
6
+ metadata.gz: 94b03b1b7a7a003a068da0799ab8de8bf594d4503f9eb763a0f68cfec3c98f8c2a90c43cf836ee42b4b31c90b872f218781ca60068dedfd10b1eb4a520d90c50
7
+ data.tar.gz: b825acd8dc75edbfb351d02a5ce622a6d75bad5b2dc1a14a011c255b31cac6afb007ee46769272d24113dacf78cafe1882af6ce0aad94e0d6fad755d1eb434d6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  Nothing new yet
4
4
 
5
+ ## [1.0.2] - 2022-01-27
6
+
7
+ - Add support of ActiveRecord `7.0.1`
8
+
9
+ ## [1.0.1] - 2021-12-26
10
+
11
+ - Add support of ActiveRecord `6.0.4.4`, `6.1.4.4` and `7.0.0`
12
+ - Fix readme
13
+
5
14
  ## [1.0.0] - 2021-11-27
6
15
 
7
16
  - Initial release
data/README.md CHANGED
@@ -8,7 +8,7 @@ Currently, the implementation only works for ActiveRecord PostgreSQL adapter. Fe
8
8
 
9
9
  Because the implementation of this gem is a patch for `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter` - carefully test its integration into your project. For example, if your project patches ActiveRecord or if some of your gems patches ActiveRecord - there might be conflicts in the implementation which could potentially lead to the data loss.
10
10
 
11
- Currently, the implementation is tested for `6.0.4.1` and `6.1.4.1` versions of ActiveRecord(see [TrxExt::SUPPORTED_AR_VERSIONS](lib/trx_ext/version.rb))
11
+ Currently, the implementation is tested for `6.0.4.4`, `6.1.4.4` and `7.0.1` versions of ActiveRecord(see [TrxExt::SUPPORTED_AR_VERSIONS](lib/trx_ext/version.rb))
12
12
 
13
13
  ## Requirements
14
14
 
@@ -38,7 +38,7 @@ Or install it yourself as:
38
38
  require 'trx_ext'
39
39
  require 'active_record'
40
40
 
41
- # Object #trx is a shorthand of ActiveRecord::Base.transaction
41
+ # Object#trx is a shorthand of ActiveRecord::Base.transaction
42
42
  trx do
43
43
  DummyRecord.first || DummyRecord.create
44
44
  end
@@ -154,8 +154,8 @@ There is "On complete" feature that allows you to define callbacks(blocks of cod
154
154
 
155
155
  ```ruby
156
156
  trx do
157
- @posts = Post.all
158
- @users = User.all
157
+ @posts = Post.all.load
158
+ @users = User.all.load
159
159
  end
160
160
  ```
161
161
 
@@ -5,29 +5,32 @@ module TrxExt
5
5
  # Wraps specified method in an +ActiveRecord+ transaction.
6
6
  #
7
7
  # @example
8
- # class Tilapia < Symbology::Base
9
- # wrap_in_trx def gnosis(number)
10
- # introspect(number, string.numerology(:kabbalah).sum)
8
+ # class User < ActiveRecord::Base
9
+ # class << self
10
+ # wrap_in_trx def find_or_create(name)
11
+ # user = find_by(name: name)
12
+ # user ||= create(name: name, title: 'Default')
13
+ # user
14
+ # end
11
15
  # end
12
16
  # end
13
17
  #
14
- # order = Tilapia.new
15
- # order.gnosis(93)
18
+ # User.find_or_create('some name')
16
19
  # # (0.6ms) BEGIN
17
- # # Introspection Load (0.4ms) SELECT "introspections".* FROM "introspections" WHERE "introspections"."id" = $1 LIMIT 1 [["id", 93]]
20
+ # # User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."name" = $1 LIMIT 1 [["name", 'some name']]
21
+ # # User Create (1.8 ms) INSERT INTO "users" ("name", "title") VALUES ($1, $2) RETURNING "id" [["name", "some name"], ["title", "Default"]]
18
22
  # # (0.2ms) COMMIT
19
- # # => 418
20
23
  #
21
24
  # @param method [Symbol] a name of the method
22
25
  # @return [Symbol]
23
26
  def wrap_in_trx(method)
24
27
  module_to_prepend = Module.new do
25
28
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
26
- def #{method}(...)
27
- trx do
28
- super
29
+ def #{method}(...)
30
+ trx do
31
+ super
32
+ end
29
33
  end
30
- end
31
34
  RUBY
32
35
  end
33
36
  prepend module_to_prepend
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrxExt
4
- VERSION = "1.0.0"
5
- SUPPORTED_AR_VERSIONS = %w(6.0.4.1 6.1.4.1).freeze
4
+ VERSION = "1.0.3"
5
+ SUPPORTED_AR_VERSIONS = %w(6.0.4.7 6.1.5 7.0.2.3).freeze
6
6
  end
data/trx_ext.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_dependency 'activerecord', '~> 6'
34
+ spec.add_dependency 'activerecord', '>= 6'
35
35
  spec.add_dependency 'pg', '~> 1.2'
36
36
  spec.add_development_dependency 'rspec', "~> 3.10"
37
37
  spec.add_development_dependency 'timecop', "~> 0.9.4"
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trx_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Dzyzenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-08 00:00:00.000000000 Z
11
+ date: 2022-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6'
27
27
  - !ruby/object:Gem::Dependency
@@ -143,8 +143,8 @@ licenses:
143
143
  metadata:
144
144
  allowed_push_host: https://rubygems.org
145
145
  homepage_uri: https://github.com/intale/trx_ext
146
- source_code_uri: https://github.com/intale/trx_ext/tree/v1.0.0
147
- changelog_uri: https://github.com/intale/trx_ext/blob/v1.0.0/CHANGELOG.md
146
+ source_code_uri: https://github.com/intale/trx_ext/tree/v1.0.3
147
+ changelog_uri: https://github.com/intale/trx_ext/blob/v1.0.3/CHANGELOG.md
148
148
  post_install_message:
149
149
  rdoc_options: []
150
150
  require_paths: