In Agile Web Development with Rails, I get this error when adding a product to my cart: uninitialized constant Cart ... Application Trace: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:200:in `const_missing'' ./public/../config/../app/controllers/store_controller.rb:21:in `find_cart'' ./public/../config/../app/controllers/store_controller.rb:9:in `add_to_cart'' This error occured while loading the following files: cart.rb Any ideas what I did wrong? I can''t find a problem with "find_cart" or "add_to_cart". My cart.rb class has been created. Thanks, Doug
In Agile Web Development with Rails, I get this error when adding a product to my cart: uninitialized constant Cart ... Application Trace: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:200:in `const_missing'' ./public/../config/../app/controllers/store_controller.rb:21:in `find_cart'' ./public/../config/../app/controllers/store_controller.rb:9:in `add_to_cart'' This error occured while loading the following files: cart.rb Any ideas what I did wrong? I can''t find a problem with "find_cart" or "add_to_cart". My cart.rb class has been created. Thanks, Doug
On 2006-01-24 17:06:41 -0500, Doug Hall <Doug_Hall@aidt.edu> said:> In Agile Web Development with Rails, I get this error when adding a > product to my cart: > > uninitialized constant Cart > ... > Application Trace: > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ > active_support/dependencies.rb:200:in `const_missing'' > ./public/../config/../app/controllers/store_controller.rb:21:in `find_cart'' > ./public/../config/../app/controllers/store_controller.rb:9:in `add_to_cart'' > > This error occured while loading the following files: > cart.rb > > Any ideas what I did wrong? I can''t find a problem with "find_cart" or > "add_to_cart". My cart.rb class has been created. > > Thanks, > DougIf you are storing Cart object in the session, you must load the models explicitly in the controller. In AWDWR (p.81 of the pdf): class ApplicationController < ActionController::Base model :cart model :line_item end
On 1/24/06, Benoit Gagnon <b.gagnon@gmail.com> wrote:> > > If you are storing Cart object in the session, you must load the models > explicitly in the controller. > > In AWDWR (p.81 of the pdf): > > class ApplicationController < ActionController::Base > model :cart > model :line_item > endDOH! I should have kept reading! Thanks! Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/7f5b3c9e/attachment.html