You can pass flash messages directly to `redirect_to`, so this could be shortened:

    redirect_to items_path, error: 'Empty search string'