Skip to content
Advertisement

how can I make this query not CaSeSeNsITIVe?

how can I make this query not Case sensitive?

  @courses = Course.where('name LIKE ?', "%#{params[:name]}%")

Advertisement

Answer

When you use a Postgres database then you might want to consider ILIKE which is the case insensitive version of LIKE:

@courses = Course.where('name ILIKE ?', "%#{params[:name]}%")
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement