app/controllers/microposts_controller.rb
def destroy
    @micropost.destroy
    flash[:success] = "Micropost deleted."
    # redirect_to request.referrer || root_url
    redirect_back(fallback_location: root_url)
  end
# request.referrer which is a method that stores the previous URL
# redirect_back added in Rails 5 and does essentially the same thing
request.referrer which is a method that stores the previous URL
redirect_back added in Rails 5 and does essentially the same thing
request . referrer which is a method that stores the previous URL redirect_back added in Rails 5 and does essentially the same thing
def destroy
    @micropost.destroy
    flash[:success] = "Micropost deleted."
    redirect_back(fallback_location: root_url)
  end
def destroy @micropost . destroy flash [ :success ] = "Micropost deleted." redirect_back ( fallback_location : root_url ) end
request.referrer which is a method that stores the previous URL
redirect_back added in Rails 5 and does essentially the same thing
request . referrer which is a method that stores the previous URL redirect_back added in Rails 5 and does essentially the same thing
# redirect_to request.referrer || root_url