Skip to content

Commit

Permalink
default proc for type-casted-binds to be logged by AR's LogSubscriber
Browse files Browse the repository at this point in the history
so that we do not have PS param values nil-ed e.g. `['created_at', nil]`

with JDBC we do not need the type-casted pieces as we're not using them
... having a proc which is used when debug logging is gets them right
the only draw-back is it will only work on recent AR 5.0/5.1 (>= 5.0.6)
(support for a loggic proc was introduced at rails/rails#29623)
  • Loading branch information
kares committed Apr 4, 2018
1 parent e77370c commit f5f70a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/arjdbc/abstract/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def log(sql, name = "SQL", binds = [], type_casted_binds = nil, statement_name =
sql: sql,
name: name,
binds: binds,
type_casted_binds: type_casted_binds,
type_casted_binds: type_casted_binds || -> { type_casted_binds(binds) }, # works since AR 5.0.6
statement_name: statement_name,
connection_id: object_id) { yield }
rescue => e
Expand Down

0 comments on commit f5f70a2

Please sign in to comment.