Created
July 16, 2010 10:46
-
-
Save jellybob/478222 to your computer and use it in GitHub Desktop.
A snippet of the Sinatra app I'm using to interact with chef databags
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
# ...snip... | |
get '/users' do | |
@users = User.all | |
erb :users | |
end | |
get '/users/new' do | |
@user = User.new | |
erb :user_form | |
end | |
post '/users' do | |
@user = User.new(params[:user]) | |
if @user.valid? | |
@user.save | |
flash[:info] = "The user account for #{@user.username} has been created, and will become active over the next 15-20 minutes." | |
redirect "/users" | |
else | |
@errors = @user.errors.full_messages | |
erb :user_form | |
end | |
end | |
# ...snip... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment