small medium large xlarge

14 Oct 2011, 05:08
Chad (1 post)

I’m working through the cart creation and I keep receiving and undefined error in Chapter 9. I believe the problem is the code in ApplicationController at the top of page 110.


class ApplicationController < ActionController::Base protect_from_forgery


def current_cart 
rescue ActiveRecord::RecordNotFound
  cart = Cart.create
  session[:cart_id] =
end end


I can’t get it to run if it’s private… wasn’t the intention to make it protected and not private? Or does the main application controller have some special rule?


17 Oct 2011, 12:31
Christian (4 posts)

Hi there!

I can’t really tell you where the problem is (I’m still new to the topic), BUT I can assure you that this code is working properly (Rails 3.1.1, Ruby 1.9.2, latest ebook 10/14), the mistake should be somewhere else.

If you’re still having problems, could you post the exact error message?


You must be logged in to comment