activerecord-import 1.7.0 → 1.8.1

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: 5aeed63fcbc9ad647ab901931265d2765baf5d0e5a1e9d2cf2c68af32dd5e1be
4
- data.tar.gz: 47480cc7244aada4bc69ba28043e8ab85ae1cece4420db4453400425a5773126
3
+ metadata.gz: 021d7d0d5b653ef01a5ab1aa23b72cca6f46abc65040014ad02fa790976f0189
4
+ data.tar.gz: a5440146848bc1bfee194681b9bf53f928150936c3c992eaec1299fec2e7c1bb
5
5
  SHA512:
6
- metadata.gz: 5f6b5749dd6ce81784f7016c6227a6d0f5047c59a45beb13616853a89599ac507241012a92c3e4f9996c7a465d4d926e0e8d1183af1854f7a0c8a05e2e59219f
7
- data.tar.gz: 72b00e7a5c61af3923b618ebe0d96f945a7af145f38ec5312962220b925e1dfc918da6028bb48d8ff7842c32584b34b06cec8fd8288dbb83212ca035f7a16c08
6
+ metadata.gz: 460961724684bc286a63ff0880ee8279a5a1528cd02ebd28e4694b8d7c39c22f19183f929ecd525de57a5069bf45218428aae47fd96ea5782e7b51a85aee0e1f
7
+ data.tar.gz: b864f8eb6fc2a074497761813f29aca981ec23daa7ae12164f1b34a08bbad6175025e6a551575ef2f53f7521f13d15de02eccb24f36c2e18dcdb04fdf77e53a7
@@ -36,6 +36,8 @@ jobs:
36
36
  ruby:
37
37
  - 3.3
38
38
  env:
39
+ - AR_VERSION: '7.2'
40
+ RUBYOPT: --enable-frozen-string-literal
39
41
  - AR_VERSION: '7.1'
40
42
  RUBYOPT: --enable-frozen-string-literal
41
43
  - AR_VERSION: '7.0'
@@ -43,6 +45,9 @@ jobs:
43
45
  - AR_VERSION: 6.1
44
46
  RUBYOPT: --enable-frozen-string-literal
45
47
  include:
48
+ - ruby: 3.2
49
+ env:
50
+ AR_VERSION: '7.2'
46
51
  - ruby: 3.2
47
52
  env:
48
53
  AR_VERSION: '7.1'
@@ -85,15 +90,6 @@ jobs:
85
90
  - ruby: 2.6
86
91
  env:
87
92
  AR_VERSION: 5.2
88
- - ruby: 2.6
89
- env:
90
- AR_VERSION: 5.1
91
- - ruby: 2.4
92
- env:
93
- AR_VERSION: '5.0'
94
- - ruby: 2.4
95
- env:
96
- AR_VERSION: 4.2
97
93
  runs-on: ubuntu-latest
98
94
  env:
99
95
  AR_VERSION: ${{ matrix.env.AR_VERSION }}
@@ -145,7 +141,7 @@ jobs:
145
141
  - uses: actions/checkout@v4
146
142
  - uses: ruby/setup-ruby@v1
147
143
  with:
148
- ruby-version: 2.7
144
+ ruby-version: 3.0
149
145
  bundler-cache: true
150
146
  - name: Run Rubocop
151
147
  run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 3.0.x
5
+
3
6
  Metrics/AbcSize:
4
7
  Enabled: false
5
8
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Changes in 1.8.1
2
+
3
+ ### Fixes
4
+
5
+ * Further update for ActiveRecord 7.2 compatibility when running validations. Thanks to @denisahearn via \##847.
6
+
7
+ ## Changes in 1.8.0
8
+
9
+ ### New Features
10
+
11
+ * Add support for ActiveRecord 7.2 via \##845.
12
+
1
13
  ## Changes in 1.7.0
2
14
 
3
15
  ### New Features
@@ -10,6 +10,10 @@ Gem::Specification.new do |gem|
10
10
  gem.homepage = "https://github.com/zdennis/activerecord-import"
11
11
  gem.license = "MIT"
12
12
 
13
+ gem.metadata = {
14
+ "changelog_uri" => "https://github.com/zdennis/activerecord-import/blob/master/CHANGELOG.md"
15
+ }
16
+
13
17
  gem.files = `git ls-files`.split($\)
14
18
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
15
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
@@ -10,7 +10,7 @@ require 'ostruct'
10
10
  # * t - the table types to test. ie: myisam, innodb, memory, temporary, etc.
11
11
  #
12
12
  module BenchmarkOptionParser
13
- BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options."
13
+ BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options.".freeze
14
14
 
15
15
  def self.print_banner
16
16
  puts BANNER
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem 'activerecord', '~> 7.2.0'
@@ -62,6 +62,7 @@ module ActiveRecord::Import # :nodoc:
62
62
  if @validate_callbacks.respond_to?(:chain, true)
63
63
  @validate_callbacks.send(:chain).tap do |chain|
64
64
  callback.instance_variable_set(:@filter, filter)
65
+ callback.instance_variable_set(:@compiled, nil)
65
66
  chain[i] = callback
66
67
  end
67
68
  else
@@ -93,7 +94,7 @@ module ActiveRecord::Import # :nodoc:
93
94
  env = ActiveSupport::Callbacks::Filters::Environment.new(model, false, nil)
94
95
  if runner.respond_to?(:call) # ActiveRecord < 5.1
95
96
  runner.call(env)
96
- else # ActiveRecord 5.1
97
+ else # ActiveRecord >= 5.1
97
98
  # Note that this is a gross simplification of ActiveSupport::Callbacks#run_callbacks.
98
99
  # It's technically possible for there to exist an "around" callback in the
99
100
  # :validate chain, but this would be an aberration, since Rails doesn't define
@@ -106,7 +107,8 @@ module ActiveRecord::Import # :nodoc:
106
107
  # no real-world use case for it.
107
108
  raise "The :validate callback chain contains an 'around' callback, which is unsupported" unless runner.final?
108
109
  runner.invoke_before(env)
109
- runner.invoke_after(env)
110
+ # Ensure a truthy value is returned. ActiveRecord < 7.2 always returned an array.
111
+ runner.invoke_after(env) || []
110
112
  end
111
113
  elsif @validate_callbacks.method(:compile).arity == 0 # ActiveRecord = 4.0
112
114
  model.instance_eval @validate_callbacks.compile
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Import
5
- VERSION = "1.7.0"
5
+ VERSION = "1.8.1"
6
6
  end
7
7
  end
data/test/models/topic.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Topic < ActiveRecord::Base
4
- if ENV['AR_VERSION'].to_i >= 6.0
4
+ if ENV['AR_VERSION'].to_f >= 6.0
5
5
  self.ignored_columns = [:priority]
6
6
  end
7
7
  alias_attribute :name, :title
@@ -19,8 +19,15 @@ class Widget < ActiveRecord::Base
19
19
 
20
20
  default_scope -> { where(active: true) }
21
21
 
22
- serialize :data, Hash
23
- serialize :json_data, JSON
22
+ if ENV['AR_VERSION'].to_f >= 7.1
23
+ serialize :data, coder: YAML
24
+ serialize :json_data, coder: JSON
25
+ serialize :custom_data, coder: CustomCoder.new
26
+ else
27
+ serialize :data, Hash
28
+ serialize :json_data, JSON
29
+ serialize :custom_data, CustomCoder.new
30
+ end
31
+
24
32
  serialize :unspecified_data
25
- serialize :custom_data, CustomCoder.new
26
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-17 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -78,6 +78,7 @@ files:
78
78
  - gemfiles/6.1.gemfile
79
79
  - gemfiles/7.0.gemfile
80
80
  - gemfiles/7.1.gemfile
81
+ - gemfiles/7.2.gemfile
81
82
  - lib/activerecord-import.rb
82
83
  - lib/activerecord-import/active_record/adapters/abstract_adapter.rb
83
84
  - lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb
@@ -184,8 +185,9 @@ files:
184
185
  homepage: https://github.com/zdennis/activerecord-import
185
186
  licenses:
186
187
  - MIT
187
- metadata: {}
188
- post_install_message:
188
+ metadata:
189
+ changelog_uri: https://github.com/zdennis/activerecord-import/blob/master/CHANGELOG.md
190
+ post_install_message:
189
191
  rdoc_options: []
190
192
  require_paths:
191
193
  - lib
@@ -200,8 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
202
  - !ruby/object:Gem::Version
201
203
  version: '0'
202
204
  requirements: []
203
- rubygems_version: 3.0.3.1
204
- signing_key:
205
+ rubygems_version: 3.3.9
206
+ signing_key:
205
207
  specification_version: 4
206
208
  summary: Bulk insert extension for ActiveRecord
207
209
  test_files: