Is it possible to refresh page and flash a notification to handle an error? I'm getting this error on my "choose_plan#new" page if the user presses the "checkout#new" button without selecting a plan. I'd prefer to show a nofication instead of only making my button work if they've selected a plan.
The error:
ActiveRecord::RecordNotFound (Couldn't find Plan without an ID):
My code:
class ChoosePlanController < ApplicationController
def new
@plans = Plan.all
class CheckoutController < ApplicationController
def new
@plan = Plan.find(params[:plan])
I'm using rails 7.0.1 and ruby 3.1.2