Skip to content

Commit

Permalink
fix: pass block argument in ActiveRecord find_by_sql patch
Browse files Browse the repository at this point in the history
`find_by_sql` takes a block as its final argument, which is neither a
positional nor a keyword argument, hence we need to pass it explicitly;
before this commit, the block was not passed to the `super()` call and
hence not executed, thus altering application behavior.

Fixes #1258
  • Loading branch information
olepbr committed Nov 20, 2024
1 parent bf6394d commit e17cf0f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class << base
module ClassMethods
method_name = ::ActiveRecord.version >= Gem::Version.new('7.0.0') ? :_query_by_sql : :find_by_sql

define_method(method_name) do |*args, **kwargs|
define_method(method_name) do |*args, **kwargs, &block|
tracer.in_span("#{self} query") do
super(*args, **kwargs)
super(*args, **kwargs, &block)
end
end

Expand Down

0 comments on commit e17cf0f

Please sign in to comment.