For consistency within the LineItemsController, who about using the same notation in the before filters:
class LineItemsController < ApplicationController
include CurrentCart
before_action :set_cart, only: %i[create]
before_action :set_line_item, only: %i[show edit update destroy]
Notice,I replaced only [:create] with only %i[create].
It’s slightly more typing, but improves consistency in code formatting with the following line, that also uses the %i[…] notation.
Since this involves only one action, it may be even better to use only: :create, or even call set_cart fron inside the (only) action that uses it.