Hi,
could u guys please help me with this syntax:
SglineItem.find(:first, :conditions => {[‘sguser_id =?’, params[:ad]],
[‘groceries_id =?’, params[:bd]]})
Full Code:
def add_to_cart
if SglineItem.find(:first, :conditions => {[‘sguser_id =?’,
params[:ad]],[‘groceries_id =?’, params[:bd]]})== nil
def add_to_cart
if SglineItem.find(:first, :conditions => {[‘sguser_id =?’,
params[:ad]],[‘groceries_id =?’, params[:bd]]})== nil
item = SglineItem.new
item.sguser_id= params[:ad]
item.groceries_id=params[:bd]
item.save!
else
item = SglineItem.find(:first, :conditions => {['sguser_id =?',
params[:ad]],[‘groceries_id =?’, params[:bd]]})
item.quantity +=1
end
redirect_to :action => “panel”, :id => params[:ad]
end
it gives undefined method `to_sym’ for [“sguser_id =?”, “3”]:Array