I know the current_cart method in the base class can find the target cart by session. However, i don’t know where the sysbol :card_id is from.
When the lineItemController calls the current_cart method, what is the value of :cart_id?
What’s is more, I have already run this common “rails generate scaffold line_item product_id:integer cart_id integer”. What is the relationship between these kinds of cart_id? class ApplicationController < ActionController::Base protect_from_forgery
private def current_cart Cart.find(session[:cart_id]) rescue ActiveRecord::RecordNotFound cart = Cart.create session[:cart_id] = cart.id cart end end