How do I make all the finders on the model ignorecase?
Posted
by Glex
on Stack Overflow
See other posts from Stack Overflow
or by Glex
Published on 2010-03-13T19:58:49Z
Indexed on
2010/03/13
20:45 UTC
Read the original article
Hit count: 249
ruby-on-rails
|mysql
I have a model with several attributes, among them title and artist.
The case of title and artist should be ignored in all the Active Record finders.
Basically, if title or artist are present in the :conditions (or dynamically i.e. find_all_by_artist), then the WHERE artist = :artist should become WHERE UPPER(artist) = UPPER(:artist) or something along these lines.
Is there a way of doing it with Rails?
© Stack Overflow or respective owner