aspose file tools*
The moose likes Ruby and the fly likes Case insensitive search in Rails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Case insensitive search in Rails" Watch "Case insensitive search in Rails" New topic
Author

Case insensitive search in Rails

Rahul Chandran
Greenhorn

Joined: Oct 14, 2010
Posts: 18
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

Joined: Nov 03, 2006
Posts: 1364
    
  17
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 :)
 
wood burning stoves
 
subject: Case insensitive search in Rails