Hello,thank you for your time.I am actually developing an e commerce website 
for selling books online.the find_cart method is mean to find the cart 
displayed at the front end-for the users buying stuffs.Your help wil be 
appreciated,am just 2 weeks old in RoR

Regards and Respects,


Kindness in thought leads to wisdom.
Kindness in speech leads to eloquence.
Kindness in action leads to love.



--- On Tue, 12/15/09, Colin Law <clan...@googlemail.com> wrote:

From: Colin Law <clan...@googlemail.com>
Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart
To: rubyonrails-talk@googlegroups.com
Date: Tuesday, December 15, 2009, 12:47 AM

2009/12/14 Oluwayomi Oluwadara <yomid...@yahoo.com>
>
> Hello,
> Thanks for your time.my bad! i never figured that out.Can you help out with 
> the find_cart method.Will greatly appreciate

Did you see the comment on top posting in my previous post?

It is always worth looking carefully at error messages as sometimes
they contain useful information.  Yours said "undefined local variable
or method `find_cart'" which could have given you a clue to the
problem.

I am afraid I cannot help out with it as I have no idea what your
application is supposed to do.  Presumably you can find something
about it in the tutorial you are following.

For beginners I always recommend working through the Rails Guides,
particularly the one on Getting Started.  See
http://guides.rubyonrails.org/

Colin

>
> Regards and Respects,
>
>
> Kindness in thought leads to wisdom.
> Kindness in speech leads to eloquence.
> Kindness in action leads to love.
>
>
>
> --- On Mon, 12/14/09, Colin Law <clan...@googlemail.com> wrote:
>
> From: Colin Law <clan...@googlemail.com>
> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart
> To: rubyonrails-talk@googlegroups.com
> Date: Monday, December 14, 2009, 9:46 AM
>
> 2009/12/14 Oluwayomi Oluwadara <yomid...@yahoo.com>
> >
> > I think i have the method, could you have a quick glance at my code:Will 
> > apreciate any correction or omission.
>
> Where? I cannot see the method find_cart in the code you have posted.
>
> By the way top posting is disapproved of here, it is easier to follow
> a thread if you insert your reply in the appropriate place in the
> previous post.
>
> Colin
>
> >
> > class InteractController < ApplicationController
> >   def index
> >    �...@products = Product.find_products_for_sale
> >   end
> >
> >   def add_to_cart
> >   product = Product.find(params[:id])
> > �...@cart = find_cart
> > �...@cart.add_product(product)
> >   rescue ActiveRecord::RecordNotFound
> >     logger.error("Attempt to access invalid product #{params[:id]}")
> >     flash[:notice] = "Invalid product"
> >     redirect_to :action => 'index'
> > end
> > def empty_cart
> >   session[:cart] = nil
> >   flash[:notice] = " Now,your cart is currently empty"
> >   redirect_to :action => 'index'
> > end
> >
> > private
> > def redirect_to_index(msg)
> >    flash[:notice] = msg
> >    redirect_to :action => 'index'
> >  end
> > end
> >
>
> --
>
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
> --
>
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

--

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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.





      

--

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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to