Skip to content

Commit

Permalink
fix: explicit nil to #compile for Rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnesthesia committed Oct 4, 2023
1 parent d3c99af commit f190e54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/activerecord-import/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def valid_model?(model)

model.run_callbacks(:validation) do
if defined?(ActiveSupport::Callbacks::Filters::Environment) # ActiveRecord >= 4.1
runner = @validate_callbacks.compile
runner = @validate_callbacks.compile(nil)
env = ActiveSupport::Callbacks::Filters::Environment.new(model, false, nil)
if runner.respond_to?(:call) # ActiveRecord < 5.1
runner.call(env)
Expand All @@ -105,7 +105,7 @@ def valid_model?(model)
runner.invoke_after(env)
end
elsif @validate_callbacks.method(:compile).arity == 0 # ActiveRecord = 4.0
model.instance_eval @validate_callbacks.compile
model.instance_eval @validate_callbacks.compile(nil)
else # ActiveRecord 3.x
model.instance_eval @validate_callbacks.compile(nil, model)
end
Expand Down

0 comments on commit f190e54

Please sign in to comment.