Adding a LIKE criteria to a Rails Conditions block
Posted
by Neil Middleton
on Stack Overflow
See other posts from Stack Overflow
or by Neil Middleton
Published on 2010-04-28T09:49:58Z
Indexed on
2010/04/28
10:13 UTC
Read the original article
Hit count: 173
Consider the following code which is to be thrown at an AR find:
conditions = []
conditions[:age] = params[:age] if params[:age].present?
conditions[:gender] = params[:gender] if params[:gender].present?
I need to add another condition which is a LIKE criteria on a 'profile' attribute. How can I do this, as obviously a LIKE is usually done via an array, not a hash key.
© Stack Overflow or respective owner