From 2005734a8ea64cd29d681db81c2bec45c64023b6 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 17:53:03 -0500 Subject: Added Session controller and helper. Also update user to have a remember_token --- app/controllers/application_controller.rb | 2 +- app/controllers/users_controller.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 03ef797..01058e3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,6 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception #include sessionhelper for the session controller and view - include SessionHelper + include SessionsHelper end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f4e1499..24d319a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,6 +3,17 @@ class UsersController < ApplicationController def new end + def create + @user = User.new(user_params) + if @user.save + sign_in @user + flash[:success] = "Welcome to the Sample App!" + redirect_to @user + else + render 'new' + end + end + def show @user = User.find(param[:id]) end -- cgit v1.2.3-2-g168b From 2426a2b1e5b6811f47f0a05dd66a001fdd117450 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 18:04:36 -0500 Subject: fixed an issue in user controller --- app/controllers/users_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 24d319a..74ab72c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -7,8 +7,7 @@ class UsersController < ApplicationController @user = User.new(user_params) if @user.save sign_in @user - flash[:success] = "Welcome to the Sample App!" - redirect_to @user + #redirect_to @user else render 'new' end -- cgit v1.2.3-2-g168b