Awesome here. Let me suggest you that instead of
def set_routine
@routine = Routine.find_by(id: params[:id])
end
You do something like:
def set_routine
@routine = Routine.find(params[:id])
end
.find_by returns nil when it doesn't found nothing and then you could face NoMethodError for NilClass.
.find raises an exception and you can better handle that with a notification or message or something.