File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Case insensitive search in Rails

 
Rahul Chandran
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any method or action in Rails 3 for case insensitive search ?



this is the code i use for searching and the database is sqlite3.
If i search for clint using this code it doesn't return any value but if searched for Clint it shows up with the results.

Thank You.
 
Katrina Owen
Sheriff
Pie
Posts: 1367
18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want all your searches on that column to be case insensitive (and because you are using sqlite3) you can specify at the database level.

If you just want that particular query to be case insensitive, you're going to need to jump through a couple more hoops, I think (I rarely use sqlite3, so there may be other options that I'm not aware of).




That will still probably fail for names with accents or funky Scandinavian characters, though.


On an unrelated note, I suggest that you add a method to your ClientWorkouts model called or some such thing that you call from your controller :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic