Skip to content

Commit f29e582

Browse files
committed
ActiveRecord::PreparedStatementInvalid in api/v1/stats # user_stats
1 parent 515f51e commit f29e582

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

app/models/concerns/heartbeatable.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,10 @@ def duration_seconds_boundary_aware(scope, start_time, end_time)
284284
.where.not(time: nil)
285285
.order(time: :asc)
286286

287-
connection.select_value(
288-
ActiveRecord::Base.sanitize_sql([
289-
"SELECT COALESCE(SUM(diff), 0)::integer
290-
FROM (#{capped_diffs.to_sql}) AS diffs
291-
WHERE time >= ?",
292-
start_time
293-
])
294-
).to_i
287+
sql = "SELECT COALESCE(SUM(diff), 0)::integer
288+
FROM (#{capped_diffs.to_sql}) AS diffs
289+
WHERE time >= #{connection.quote(start_time)}"
290+
connection.select_value(sql).to_i
295291
end
296292
end
297293
end

0 commit comments

Comments
 (0)