oh  wait..  ignore that.   of course it will work but it just creates
a new cart.  :-\  sorry,  long day

On Mar 17, 4:54 pm, Tony Primerano <[email protected]> wrote:
> does it work when you uncomment this line in destroy?
>
> # @cart = current_cart
>
> On Mar 17, 4:31 pm, radhames brito <[email protected]> wrote:
>
> > oookk, so i have 2 actions , create and destroy, i can get
> > session[:cart_id] from inside the create method but not from inside
> > the delete method.
>
> > def create
> >     @cart = current_cart
> >     Rails.logger.debug "SESSION INFO HERE
> > #{session[:cart_id]}"         this here is 18
>
> > .
> > .
> > .
>
> >  def destroy
> >     # @cart = current_cart
> >     @line_item = LineItem.find(params[:id])
> >     Rails.logger.debug "SESSION INFO HERE
> > #{session[:cart_id]}"         this here is nil
>
> > .
> > .
> > .
>
> > here is how i create the cart
>
> > private
> >   def current_cart
> >     begin
> >       Cart.find(session[:cart_id])
> >     rescue ActiveRecord::RecordNotFound
> >       Rails.logger.debug "SESSION IS #{session.inspect}"           <==
> > is empty when i call it from the destroy method
> >      cart = Cart.create
> >      session[:cart_id] = cart.id
> >      cart
> >     end
> >   end
>
> > anyone knows whats going on?
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to