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@googlegroups.com.
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.

Search Discussions

  • Rene_gr at Jan 4, 2012 at 1:29 pm
    hey, you might ne interested in squeel gem:
    https://github.com/ernie/squeel

    Hope this helps!
    On Jan 3, 9:28 pm, femto Zheng 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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 3, '12 at 8:28p
activeJan 4, '12 at 1:29p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Rene_gr: 1 post femto Zheng: 1 post

People

Translate

site design / logo © 2022 Grokbase