Oluwayomi Oluwadara
2009-Dec-13 18:35 UTC
Need help...NameError in InteractController#add_to_cart
Hi,I am developing a web app and am following the text-Agile web development.....Each time I click my "add to cart" button" i always get the page below:I have double checked to see if i have errors in my code,there was none,please what do i need to do to proceed? NameError in InteractController#add_to_cartundefined local variable or method `find_cart'' for #<InteractController:0x1042d0780>RAILS_ROOT: /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritageApplication Trace | Framework Trace | Full Trace/Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritage/app/controllers/interact_controller.rb:8:in `add_to_cart'' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `send'' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in `perform_action_without_filters'' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:617:in `call_filters''Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Susan McM. Tucker
2009-Dec-13 18:48 UTC
Re: Need help...NameError in InteractController#add_to_cart
Though I have only been playing with Rails for about a month, I think I can answer this one. You need to define add_a_cart in the store_controller.rb. Good luck. *susan*> Hi,I am developing a web app and am following the text-Agile web > development..... > Each time I click my "add to cart" button" i always get the page below:I have > double checked to see if i have errors in my code,there was none,please what > do i need to do to proceed? > > NameError in InteractController#add_to_cart > undefined local variable or method `find_cart'' for > #<InteractController:0x1042d0780> > RAILS_ROOT: > /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritageApplicatio > n Trace <http://0.0.0.0:3000/interact/add_to_cart/17#> | Framework Trace > <http://0.0.0.0:3000/interact/add_to_cart/17#> | Full Trace > <http://0.0.0.0:3000/interact/add_to_cart/17#> > /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritage/app/contr > ollers/interact_controller.rb:8:in `add_to_cart'' > /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:133 > 1:in `send'' > /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:133 > 1:in `perform_action_without_filters'' > /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb: > 617:in `call_filters''Regards and Respects, > > > Kindness in thought leads to wisdom. > Kindness in speech leads to eloquence. > Kindness in action leads to love. > > > > > -- > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-14 15:47 UTC
Re: Need help...NameError in InteractController#add_to_cart
This is what I have got.Will appreciate it if you can go through this and amend.Note the method highlighted. class InteractController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart -wb5DWc3F33w@public.gmane.org_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 Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. --- On Sun, 12/13/09, Susan McM. Tucker <smtucker-jD0SwthQj9uc2IqEiuaW8sk87cqNqjZ2@public.gmane.org> wrote: From: Susan McM. Tucker <smtucker-jD0SwthQj9uc2IqEiuaW8sk87cqNqjZ2@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Sunday, December 13, 2009, 10:48 AM Though I have only been playing with Rails for about a month, I think I can answer this one. You need to define add_a_cart in the store_controller.rb. Good luck. *susan*> Hi,I am developing a web app and am following the text-Agile web > development..... > Each time I click my "add to cart" button" i always get the page below:I have > double checked to see if i have errors in my code,there was none,please what > do i need to do to proceed? > > NameError in InteractController#add_to_cart > undefined local variable or method `find_cart'' for > #<InteractController:0x1042d0780> > RAILS_ROOT: > /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritageApplicatio > n Trace <-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Norm Scherer
2009-Dec-14 15:55 UTC
Re: Need help...NameError in InteractController#add_to_cart
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Oluwayomi Oluwadara wrote: <blockquote cite="mid:878788.80394.qm-CdvOQls3UWWB9c0Qi4KiSlZ8N9CAUha/QQ4Iyu8u01E@public.gmane.org" type="cite"> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">Hi, <div>I am developing a web app and am following the text-Agile web development.....</div> <div>Each time I click my "add to cart" button" i always get the page below:I have double checked to see if i have errors in my code,there was none,please what do i need to do to proceed?</div> <div><br> <span style="font-family: Times New Roman;"><span style="font-style: italic;"><span class="Apple-style-span" style="font-family: verdana,arial,helvetica,sans-serif; font-style: normal; color: rgb(51, 51, 51); line-height: 18px;"> <h1>NameError in InteractController#add_to_cart</h1> <pre style="padding: 10px; background-color: rgb(238, 238, 238); font-size: 11px;">undefined local variable or method `find_cart'' for #<InteractController:0x1042d0780></pre> </span></span></span></div> </td> </tr> </tbody> </table> </blockquote> <code>You need a method ''find_cart''</code><br> </body> </html> <p></p> <p>--</p> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.<br /> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.<br />
Oluwayomi Oluwadara
2009-Dec-14 17:07 UTC
Re: Need help...NameError in InteractController#add_to_cart
I think i have the method, could you have a quick glance at my code:Will apreciate any correction or omission. class InteractController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart -wb5DWc3F33w@public.gmane.org_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 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, Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: From: Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Monday, December 14, 2009, 7:55 AM Oluwayomi Oluwadara wrote: Hi, I am developing a web app and am following the text-Agile web development..... Each time I click my "add to cart" button" i always get the page below:I have double checked to see if i have errors in my code,there was none,please what do i need to do to proceed? NameError in InteractController#add_to_cart undefined local variable or method `find_cart'' for #<InteractController:0x1042d0780> You need a method ''find_cart'' -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2009-Dec-14 17:46 UTC
Re: Need help...NameError in InteractController#add_to_cart
2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > 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 > -wb5DWc3F33w@public.gmane.org_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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-14 21:45 UTC
Re: Need help...NameError in InteractController#add_to_cart
Hello,Thanks for your time.my bad! i never figured that out.Can you help out with the find_cart method.Will greatly appreciate 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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Monday, December 14, 2009, 9:46 AM 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > 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 > -wb5DWc3F33w@public.gmane.org_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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2009-Dec-15 08:47 UTC
Re: Need help...NameError in InteractController#add_to_cart
2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > Hello, > Thanks for your time.my bad! i never figured that out.Can you help out with the find_cart method.Will greatly appreciateDid 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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Date: Monday, December 14, 2009, 9:46 AM > > 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> > > > > 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 > > -wb5DWc3F33w@public.gmane.org_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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
amit kumar
2009-Dec-15 08:50 UTC
Re: Need help...NameError in InteractController#add_to_cart
Hi, Check if find_cart may be some method which you must be missing, either check your helper file too. 2009/12/15 Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>> 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> > > > > 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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > Subject: Re: [Rails] Need help...NameError in > InteractController#add_to_cart > > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > Date: Monday, December 14, 2009, 9:46 AM > > > > 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> > > > > > > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- Regards, Amit Kumar Sr. Software Engrr +91 9890654102 +91 9373087399 Blogsite: http://amitbaraik.blog.co.in/ This e-mail is confidential and may be legally privileged. If you are not the intended recipient, please notify the sender immediately and delete this e-mail. ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
maryam kamali
2009-Dec-15 09:27 UTC
Re: Need help...NameError in InteractController#add_to_cart
NO I NOT THINK ABOUT ITHOUGHT ABUT THAT RUBYONRAILS Y ADD ME EVRY DAYCONTIGUITY THAT ISVERY MANY On Mon, Dec 14, 2009 at 8:37 PM, Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>wrote:> I think i have the method, could you have a quick glance at my code:Will > apreciate any correction or omission. > > > 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 > > > 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, Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org>* wrote: > > > From: Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> > > Subject: Re: [Rails] Need help...NameError in > InteractController#add_to_cart > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Date: Monday, December 14, 2009, 7:55 AM > > > Oluwayomi Oluwadara wrote: > > Hi, > I am developing a web app and am following the text-Agile web > development..... > Each time I click my "add to cart" button" i always get the page below:I > have double checked to see if i have errors in my code,there was none,please > what do i need to do to proceed? > > NameError in InteractController#add_to_cart > > undefined local variable or method `find_cart'' for #<InteractController:0x1042d0780> > > You need a method ''find_cart'' > > -- > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-15 09:39 UTC
Re: Need help...NameError in InteractController#add_to_cart
this is what i have> > class InteractController < ApplicationController > > def index > > @products = Product.find_products_for_sale > > end > > > > def add_to_cart > > product = Product.find(params[:id]) > > @cart = find_cart > > -wb5DWc3F33w@public.gmane.org_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 > > > > --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, amit kumar <amitbaraik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: From: amit kumar <amitbaraik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Tuesday, December 15, 2009, 12:50 AM Hi, Check if find_cart may be some method which you must be missing, either check your helper file too. 2009/12/15 Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>>> Hello,> Thanks for your time.my bad! i never figured that out.Can you help out with the find_cart method.Will greatly appreciateDid 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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:>> From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart> To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Date: Monday, December 14, 2009, 9:46 AM>> 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> >> > 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> > -wb5DWc3F33w@public.gmane.org_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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- Regards, Amit Kumar Sr. Software Engrr +91 9890654102 +91 9373087399 Blogsite: http://amitbaraik.blog.co.in/ This e-mail is confidential and may be legally privileged. If you are not the intended recipient, please notify the sender immediately and delete this e-mail. ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-15 22:42 UTC
Re: Need help...NameError in InteractController#add_to_cart
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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Tuesday, December 15, 2009, 12:47 AM 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > Hello, > Thanks for your time.my bad! i never figured that out.Can you help out with the find_cart method.Will greatly appreciateDid 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 <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart > To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Date: Monday, December 14, 2009, 9:46 AM > > 2009/12/14 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> > > > > 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 > > -wb5DWc3F33w@public.gmane.org_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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
- which tutorial are u following? - can u show ur cart-model? -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Norm Scherer
2009-Dec-15 23:04 UTC
Re: Need help...NameError in InteractController#add_to_cart
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Oluwayomi Oluwadara wrote: <blockquote cite="mid:445176.24238.qm-cvin7FYlzkWB9c0Qi4KiSlZ8N9CAUha/QQ4Iyu8u01E@public.gmane.org" type="cite"> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">Hello, <div>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<br> <br> <span style="font-family: Times New Roman;"><span style="font-style: italic;">Regards and Respects,<br> </span></span></div> </td> </tr> </tbody> </table> </blockquote> In the sample application used in ''Agile Web Development with Rails'' they define a Cart class (which is not derived from ActiveRecord::Base). In their StoreController class they define a find_cart method as:<br> [code]<br> def find_cart <br> @cart = (session[:cart] ||= Cart.new)<br> end<br> [/code]<br> Whether this has any applicability to your case is impossible to know without knowing a lot more about your application.<br> </body> </html> <p></p> <p>--</p> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.<br /> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.<br />
Oluwayomi Oluwadara
2009-Dec-16 03:31 UTC
Re: Need help...NameError in InteractController#add_to_cart
i am actually following the book because am doing EXACTLY the same thing.this is my code, have a look at time .will appreciate corrections.i am sick of seeing the error message. class InteractController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart -wb5DWc3F33w@public.gmane.org_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 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, Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: From: Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Tuesday, December 15, 2009, 3:04 PM Oluwayomi Oluwadara wrote: 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, In the sample application used in ''Agile Web Development with Rails'' they define a Cart class (which is not derived from ActiveRecord::Base). In their StoreController class they define a find_cart method as: [code] def find_cart @cart = (session[:cart] ||= Cart.new) end [/code] Whether this has any applicability to your case is impossible to know without knowing a lot more about your application. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-16 12:15 UTC
Re: Need help...NameError in InteractController#add_to_cart
I am following the text" agile web development with rails"here is my code, class InteractController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart -wb5DWc3F33w@public.gmane.org_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 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, tom <tomabroad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: From: tom <tomabroad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Tuesday, December 15, 2009, 2:47 PM - which tutorial are u following? - can u show ur cart-model? -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2009-Dec-16 13:39 UTC
Re: Need help...NameError in InteractController#add_to_cart
2009/12/16 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > I am following the text" agile web development with rails" > here is my code,There is no point repeatedly posting the same code. As has been pointed out several times the problem is that you are missing the find_cart method. In Agile Development With Rails this is in the StoreController, as has also been pointed out to you previously. I suggest you go back to the book and have another look. I believe you can even download the application source if you wish. Colin -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-16 16:39 UTC
Re: Need help...NameError in InteractController#add_to_cart
thanks a bunch Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. --- On Wed, 12/16/09, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Wednesday, December 16, 2009, 5:39 AM 2009/12/16 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > I am following the text" agile web development with rails" > here is my code,There is no point repeatedly posting the same code. As has been pointed out several times the problem is that you are missing the find_cart method. In Agile Development With Rails this is in the StoreController, as has also been pointed out to you previously. I suggest you go back to the book and have another look. I believe you can even download the application source if you wish. Colin -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oluwayomi Oluwadara
2009-Dec-17 16:03 UTC
Re: Need help...NameError in InteractController#add_to_cart
Hello,when i added the find-cart method(private access) that the controller is loking for, am now getting this syntax error message.Ithis is my method: private def find_cart session[:cart] ||= Cart.new end SyntaxError in InteractController#add_to_cart/Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritage/app/models/cart.rb:19: syntax error, unexpected $end, expecting kENDRegards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. --- On Wed, 12/16/09, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: From: Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Wednesday, December 16, 2009, 5:39 AM 2009/12/16 Oluwayomi Oluwadara <yomidara-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>> > I am following the text" agile web development with rails" > here is my code,There is no point repeatedly posting the same code. As has been pointed out several times the problem is that you are missing the find_cart method. In Agile Development With Rails this is in the StoreController, as has also been pointed out to you previously. I suggest you go back to the book and have another look. I believe you can even download the application source if you wish. Colin -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Norm Scherer
2009-Dec-17 16:45 UTC
Re: Need help...NameError in InteractController#add_to_cart
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> The error is in your model/cart.rb around line 19 as the error message indicates. Read the error messages closely and you will find a lot of information. The error indicates that you have a syntax error in model/cart.rb. Maybe a block opened without an end or quotes not matching or parentheses not matching etc.<br> </body> </html> <p></p> <p>--</p> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.<br /> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org<br /> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.<br />
Oluwayomi Oluwadara
2009-Dec-17 20:35 UTC
Re: Need help...NameError in InteractController#add_to_cart
Hello,thank you.Ut worked wonders! Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. --- On Thu, 12/17/09, Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: From: Norm Scherer <normscherer-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Date: Thursday, December 17, 2009, 8:45 AM The error is in your model/cart.rb around line 19 as the error message indicates. Read the error messages closely and you will find a lot of information. The error indicates that you have a syntax error in model/cart.rb. Maybe a block opened without an end or quotes not matching or parentheses not matching etc. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.