Re: session question..

Jay Pangmi
Sun, 12 Oct 2008 00:21:32 -0000

Ok, Now as I''ve made session[:cart_ids] and array with:

session[:cart_ids] ||= []

how can I clear all the stored ids in the session coz
''session[:cart_ids] = nil'' isn''t working. Also as I
have ids in the
array referenced by session[:cart_ids] and that the carts table only
stored the camp location, to get the id of each camp location stored in
the cart, I''m doing:

@cart=Cart.find(session[:cart_ids])

for item in @cart
 @camp_id=Campsite.find(:all, :conditions => [''camp_location =
?'',item.campsite])
 Booking.create(......,:camp_id => @camp_id.id)
end

But, it doesn''t seem to work. Any better way? plz suggest me.. thanks.