|
|
|
@@ -1,5 +1,7 @@ |
|
|
|
class CartsController < ApplicationController |
|
|
|
before_action :set_cart, only: [:show, :edit, :update, :destroy] |
|
|
|
# QUESTION: How do we call this with call? |
|
|
|
rescue_from ActiveRecord::RecordNotFound, with: :invalid_cart |
|
|
|
|
|
|
|
# GET /carts |
|
|
|
# GET /carts.json |
|
|
|
@@ -71,4 +73,9 @@ class CartsController < ApplicationController |
|
|
|
def cart_params |
|
|
|
params.fetch(:cart, {}) |
|
|
|
end |
|
|
|
|
|
|
|
def invalid_cart |
|
|
|
logger.error "Attempt to access invalid cart #{params[:id]}" |
|
|
|
redirect_to store_index_url, notice: 'Invalid cart' |
|
|
|
end |
|
|
|
end |