Having trouble when I try to add a second condition to find. I’ve
tried search and referencing
ActiveRecord::Base,
but not seeing a clear answer on my syntax.
Working code:
def cc_class_six
@products = Product.find(:all, :conditions =>[‘store LIKE ?’, ‘%’ +
‘class’ +‘%’])
return @products
end
Code where I’ve added a second condition to find by that returns
syntax errors:
def cc_class_six
@products = Product.find(:all, :conditions =>[‘store LIKE ?’, ‘%’ +
‘class’ +‘%’] and ["city=‘corpus christi’ "])
return @products
end
I’ve tried several variations, but all return syntax errors:
:conditions =>[‘store LIKE ?’, ‘%’ + ‘class’ +‘%’ and "city=‘corpus
christi’ "])
:conditions =>[‘store LIKE ?’, ‘%’ + ‘class’ +‘%’ and ‘city=‘corpus
christi’ ‘])
:conditions =>[‘store LIKE ?’, ‘%’ + ‘class’ +’%’] and ['city=‘corpus
christi’ '])
Any ideas?