From 89976ad75082c4ab5f0a2b2e8be3a0811989a2bd Mon Sep 17 00:00:00 2001 From: Beatrice Olivera Date: Tue, 28 Aug 2018 17:41:10 +0100 Subject: [PATCH] edited routes to redirect to correct pages upon sign up --- app/controllers/application_controller.rb | 4 ++++ config/routes.rb | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a0dedd0..28c2bff 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,8 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception # before_action :authenticate_user! protect_from_forgery unless: -> { request.format.json? } # Only accept json + + def after_sign_in_path_for(resource) + contacts_path + end end diff --git a/config/routes.rb b/config/routes.rb index 38d448f..9c527a9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,15 @@ Rails.application.routes.draw do devise_scope :user do get '/logout', to: 'devise/sessions#destroy' end - root to: 'pages#home' + + authenticated :user do + root to: "pages#index" + end + + unauthenticated :user do + root to: "pages#home" + end + get '/contacts', to: 'pages#index' post '/sessions', to: 'video_sessions#create'