Skip to content

Commit

Permalink
activerecord: log unnamed bind params
Browse files Browse the repository at this point in the history
  • Loading branch information
ushi-as committed Apr 28, 2022
1 parent c5253dc commit fe62bb5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion activerecord/lib/active_record/log_subscriber.rb
Expand Up @@ -51,7 +51,14 @@ def sql(event)

binds = []
payload[:binds].each_with_index do |attr, i|
attribute_name = attr.respond_to?(:name) ? attr.name : attr[i].name
attribute_name = if attr.respond_to?(:name)
attr.name
elsif attr.respond_to?(:[]) && attr[i].respond_to?(:name)
attr[i].name
else
nil
end

filtered_params = filter(attribute_name, casted_params[i])

binds << render_bind(attr, filtered_params)
Expand Down

0 comments on commit fe62bb5

Please sign in to comment.