gizzard 0.6.1 → 0.7.0

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
  SHA256:
3
- metadata.gz: 81d147ac8288bce93fda46dada8bb6db91d2be7144cc7047699eb5ded19e2e0c
4
- data.tar.gz: f5737b10b7bf1ad26771f6930fb3c133cf7017783680ffc6c9b78a2975dbdd9b
3
+ metadata.gz: 7835d4c05720dfbe30c00af4019b823ce0e5098c4151ced2744147272bbddd87
4
+ data.tar.gz: 6735ab05f95da9f5ac49846f33856fba7d7efb3a34803a344e5ec3c78097b94a
5
5
  SHA512:
6
- metadata.gz: 1d2baf44f2ace1f7d4634eeedc0e5ddf56b4aadc90446b155d03b2560329b6f43e3336a09eecf702215b551402e3c09a636399d7b16781d8c29e99ff8117a387
7
- data.tar.gz: 5048e964a75f0402202319ce5bda883709429e616cf520dc59d458b34493c0eacc165cba92fe43b90a5ccc8dfb308e4763afd8d6ead996a20d78e994cc6ec0ac
6
+ metadata.gz: 316d1946ed962e152b33aae18b72188d4b4ae04495d5da3184db902143a95dd93534ff401ddb4cbd71b78bf7711c08cb7b3511dee29d1f6ca8b8fcf88cce1ed5
7
+ data.tar.gz: 30ee2722af67585d7888257bcb04aae0dd8850077e1c8104b1734db3080d1003e32da7b52aa7aac9758c53290aaf79394fc73e30fd2ae25aa6d2a86629a60143
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Gizzard
2
2
 
3
+ [![Build Status](https://github.com/taka0125/gizzard/workflows/Ruby/badge.svg?branch=main)](https://github.com/taka0125/gizzard/actions)
4
+
3
5
  Often use snippet for ActiveRecord.
4
6
 
5
7
  ## Installation
data/lib/gizzard/base.rb CHANGED
@@ -3,6 +3,14 @@ module Gizzard
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  class_methods do
6
+ def preload_associations(records:, associations:, scope: nil)
7
+ if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new(7)
8
+ ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
9
+ else
10
+ ActiveRecord::Associations::Preloader.new.preload(records, associations, scope)
11
+ end
12
+ end
13
+
6
14
  def delete_all_by_id(batch_size: 1000)
7
15
  ids = pluck(:id)
8
16
  ids.sort!
@@ -1,3 +1,3 @@
1
1
  module Gizzard
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gizzard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-09 00:00:00.000000000 Z
11
+ date: 2022-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.2.22
214
+ rubygems_version: 3.1.6
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Often use snippet for ActiveRecord.