aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/registrations_controller.rb
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-11 20:25:57 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-11 20:25:57 +0000
commit8ef8a8661bf4663e776497c3cbc55e3dceb63481 (patch)
tree1db4c5311210c1a38f9e8815d8f37a38cf4b6427 /app/controllers/registrations_controller.rb
parent6c13cfb192ab4250e446f2d2212a701ffbd447e8 (diff)
Can now sign up
Diffstat (limited to 'app/controllers/registrations_controller.rb')
-rw-r--r--app/controllers/registrations_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 13ef4dd..ee0d70e 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -1,8 +1,22 @@
class RegistrationsController < ApplicationController
allow_unauthenticated_access only: %i[ new create ]
def new
+ @user = User.new
end
def create
+ @user = User.create(user_params)
+ if @user.save
+ start_new_session_for @user
+ redirect_to root_path, notice: "Successfully signed up!"
+ else
+ render :new
+ end
+ end
+
+ private
+
+ def user_params
+ params.expect(user: [:first_name, :last_name, :email_address, :password, :password_confirmation])
end
end \ No newline at end of file