I want to programatically create this SQL with single bind parameter with Arel:
"users"."first_name" ILIKE $1 OR "users"."last_name" ILIKE $1
I tried:
users = Arel::Table.new("users")
term = Arel::Nodes::BindParam.new("term") # what is the argument even used for?
users[:first_name].matches(p)
.or(
users[:last_name].matches(p)
)
But it results in two different bind variables:
("users"."first_name" ILIKE $1 OR "users"."last_name" ILIKE $2)
Is there a way to do this or should I just use Arel::Nodes::SqlLiteral.new("$1") instead of BindParam?