app/controllers/application_controller.rb
# use this helper method to protect controller actions where user must be logged in to proceed
use this helper method to protect controller actions where user must be logged in to proceed
use this helper method to protect controller actions where user must be logged in to proceed
def redirect_if_not_logged_in
      if !logged_in?
        flash[:errors] = "You must be logged in to view the page you tried to view."
        redirect '/'
      end
    end
def redirect_if_not_logged_in if ! logged_in? flash [ :errors ] = "You must be logged in to view the page you tried to view." redirect '/' end end
use this helper method to protect controller actions where user must be logged in to proceed
use this helper method to protect controller actions where user must be logged in to proceed