Skip to content

Instantly share code, notes, and snippets.

@jkarnowski
Created January 22, 2016 23:55
Show Gist options
  • Save jkarnowski/9e5d919fe6d5c6d27435 to your computer and use it in GitHub Desktop.
Save jkarnowski/9e5d919fe6d5c6d27435 to your computer and use it in GitHub Desktop.
# 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