Hello all, I''ve recently been on a project where somewhere needs
using case insensitive search(using UPPER(name) LIKE '''') and
LIKE condition,
I want to use arel and don''t use the old style string concatenation,
can arel handle this?
But I check on arel documentation, doesn''t seems have any upper/like
operator,
and check on arel source, under lib/arel/nodes,
doesn''t seem to have any node related to this,
can arel handl this?
Thanks.
ps, the arel way of binding value seems to have its own invocation,
using eq(xxx),
accounts = Account.arel_table
Account.where(accounts[:id].eq(1).or(accounts[:id].eq(2)))
different from where rails old style binding,
like where(:conditions=>[UPPER(name) like ?, ''%#{xxx}%]],
so How can I bind them two?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
hey, you might ne interested in squeel gem: https://github.com/ernie/squeel Hope this helps! On Jan 3, 9:28 pm, femto Zheng <femto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, I''ve recently been on a project where somewhere needs > using case insensitive search(using UPPER(name) LIKE '''') and LIKE condition, > I want to use arel and don''t use the old style string concatenation, > can arel handle this? > But I check on arel documentation, doesn''t seems have any upper/like > operator, > and check on arel source, under lib/arel/nodes, > doesn''t seem to have any node related to this, > can arel handl this? > Thanks. > ps, the arel way of binding value seems to have its own invocation, > using eq(xxx), > > accounts = Account.arel_table > Account.where(accounts[:id].eq(1).or(accounts[:id].eq(2))) > > different from where rails old style binding, > like where(:conditions=>[UPPER(name) like ?, ''%#{xxx}%]], > so How can I bind them two?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- Arel limit Where if fields are present
- A "strict Arel" mode for ActiveRecord to prevent SQL injection vulnerabilities
- ActiveRecord and ARel: correlated subqueries?
- Arel quiz: complex queries with associations
- Issue with Arel::SelectManager and insert Method