Redirect to log in page if user is not authenticated with Devise
Just simple add this method to application_controller.rb protected def authenticate_user! if user_signed_in? super else redirect_to login_path, :notice => ‘if you want to add a notice’ ## if you want render 404 page ## render :file => File.join(Rails.root, ‘public/404’), :formats => [:html], :status => 404, :layout => false end end And you can call this method … Read more