The-Apiary / buzz

A podcast client with functionality inspired by Rdio
0 stars 2 forks source link

Search Controller relies on raw sql #11

Open everett1992 opened 10 years ago

everett1992 commented 10 years ago

I quickly implemented a fuzzy search using SQL LIKE clause as follows

Podcast.where("title LIKE ?", "%#{params[:q]}%")

This isn't treated the same by all SQl implementations (i.e sqlite searches case insensitive, posgresql case sensitive). It's generally bad to use raw SQL instead of letting ActiveRecord, or a library handle it.

everett1992 commented 10 years ago

Search is now using sql that works in sqlite and postgres, but it still needs to be abstracted more.