class CartsController < ApplicationController
  def create
    item = Item.find(params[:item_id])
    flash[:notice] = "You have added 1 #{item.title} to your cart."
    redirect_to items_path
  end
end

class CartsController < ApplicationController
  include ActionView::Helpers::TextHelper

  def create
    id = params[:item_id].to_s
    item = Item.find(id)
    session[:cart] ||= {}
    session[:cart][id] = (session[:cart][id] || 0) + 1
    flash[:notice] = "Your cart now contains #{pluralize(session[:cart][id], item.title)}."
    redirect_to items_path
  end
end

Implement adding multiple items to a cart
Implement adding multiple items to a cart
