master
 1class FavoritesController < ApplicationController
 2  before_action :authenticate!
 3
 4  def create
 5    cake = Creation.find(params[:cake_id])
 6    current_user.add_favorite(cake)
 7
 8    redirect_to cake_path(cake), notice: "This has been added to your favorites"
 9  end
10end