Case Insensitive Where Statement Using SQL In Rails

Posted by Weston Ganger on January 29, 2016

If you want to make your where statement case insensitive on a column you can use the SQL function lower

I needed this for some import / export scripts I was running.

val = 'rails'
Post.where('lower(title) LIKE ?', val)

Related External Links:

Posted in Rails and Tagged with rails sql 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts