Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created May 23, 2016 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuroyoro/a22b977a1f5de495f2610abc81e5b5f5 to your computer and use it in GitHub Desktop.
Save yuroyoro/a22b977a1f5de495f2610abc81e5b5f5 to your computer and use it in GitHub Desktop.
Arel::SelectManager#where_sql が bind_valuesを展開しないのは実装さぼってるだけだと思うの
module Arel
class SelectManager
def where_sql_with_bind_values
return if @ctx.wheres.empty?
viz = Visitors::WhereSql.new @engine.connection
binds = bind_values.dup
binds.map! { |bv| @engine.connection.quote(*bv.reverse) }
collect = viz.accept(@ctx, Arel::Collectors::Bind.new)
collect.substitute_binds(binds).join
collect.substitute_binds(binds).join
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment