I was doing the excercises in Agile Rails book and there is a private method inside application_controller.rb which is defined as:
private
def current_cart
Cart.find(session[:cart_id])
rescue ActiveRecord::RecordNotFound
cart = Cart.create session[:cart_id] = cart.id cart
end
This method can be called from inside UserController#index(method) but I cannot call it like:
class UserController < ApplicationController
@cart = current_cart
...
why is that?