Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staycreativedesign/0371646af3a9c20f371c29261f4cea53 to your computer and use it in GitHub Desktop.
Save staycreativedesign/0371646af3a9c20f371c29261f4cea53 to your computer and use it in GitHub Desktop.
class ActiveStorage::BaseController < ApplicationController
include ActiveStorage::SetCurrent
before_action :authenticate_user!
protect_from_forgery with: :exception
def authenticate_user!
if current_user
else
flash[:danger] = 'Unable to process your request'
redirect_to root_path
end
end
end
@nilbus
Copy link

nilbus commented Jun 11, 2020

Just fix that conditional. 😄

    unless current_user
      flash[:danger] = 'Unable to process your request'
      redirect_to root_path
    end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment