← Back to Upcase

Too many redirects


(Damian Simon Peter) #1

While following this tutorial, https://thoughtbot.com/upcase/videos/intermediate-part-1 , I had this error on my browser too many redirects, localhost is redirecting too many timesI guessed its because of the before_filter :check_if_logged_in_user? in my ApplicationsController. So I moved this to the HomesController and left the check_if_user_logged_in method in the ApplicationsController it worked well. Using rails 5, this is what I have currently.

  include Monban::ControllerHelpers 
  protect_from_forgery with: :exception 
  
  private 

  def check_if_logged_in_user 
     redirect_to dashboard_path if signed_in?
  end 
end ```

```class HomesController < ApplicationController 
   before_action :check_if_logged_in_user 
end  ```

My question is:
1. Am I doing it the right way?
2. Why was the initial approach not working?
Thanks in anticipation.

@Matthew_Mongeau