summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorTomer Kimia <tkimia@purdue.edu>2014-03-03 19:00:25 -0500
committerTomer Kimia <tkimia@purdue.edu>2014-03-03 19:00:25 -0500
commitfb8aedbf8f39c627e6537c567f030b389cfb3cfb (patch)
tree714e1a5294f839c4a5c22195e5f4685af847f6a8 /app/controllers
parent38c41dc461244832d739b755e073989c61dacf47 (diff)
parentcd69a777235e96266d4ed101ef22de7ed1308dd5 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/sessions_controller.rb9
-rw-r--r--app/controllers/tournaments_controller.rb6
-rw-r--r--app/controllers/users_controller.rb9
3 files changed, 17 insertions, 7 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 8a9de56..68cb949 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -3,23 +3,20 @@ class SessionsController < ApplicationController
def new
end
+ # find the user and create a new session
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
sign_in user
- #redirect goes here
+ redirect_to root_path
else
render 'new'
end
end
def destroy
-
sign_out
-
- #I dont know where to redirect to so yeah
- # redirect_to sign_in
-
+ redirect_to root_path
end
end
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 56233b6..27ba020 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -22,6 +22,12 @@ class TournamentsController < ApplicationController
def edit
end
+ def selected
+ render :update do |page|
+ page.replace_html 'ajax-form', :partial => 'selected'
+ end
+ end
+
# POST /tournaments
# POST /tournaments.json
def create
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 74ab72c..6436e4e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,13 +1,14 @@
class UsersController < ApplicationController
def new
+ @user = User.new
end
def create
@user = User.new(user_params)
if @user.save
sign_in @user
- #redirect_to @user
+ redirect_to root_path
else
render 'new'
end
@@ -16,4 +17,10 @@ class UsersController < ApplicationController
def show
@user = User.find(param[:id])
end
+
+ private
+
+ def user_params
+ params.require(:user).permit(:name, :email, :user_name, :password, :password_confirmation)
+ end
end