Tutorial :Rails conditions equal to one of an array- Syntax Errors


Hi I am trying to understand why I get a syntax error for this:

:conditions => ["rank = ? and primaries.relationship = ?", ['CPT','SFC'], "Spouse"]

I need to check "rank" against an Array of options.

Seems like this should be pretty simple, any suggestions?


Something like this perhaps:

:conditions => ["rank IN (?, ?) AND primaries.relationship = ?", 'CPT','SFC', "Spouse"]  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »