Created
January 22, 2016 23:55
-
-
Save jkarnowski/9e5d919fe6d5c6d27435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WHAT REQUEST ALLOWS FOR USER REGISTRATION? | |
get '/users/new' do | |
erb :'users/new' | |
end | |
# WHAT REQUEST SENDS THE USER DATA TO THE DATABASE? | |
# this is one approach to accepting params. Can accept params a few different ways. | |
post '/users' do | |
user = User.new(params) | |
if user.save | |
login(user) | |
redirect '/' | |
else | |
erb :'users/new' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment