Skip to content

Instantly share code, notes, and snippets.

@jathayde
Created March 17, 2010 14:16
Show Gist options
  • Save jathayde/335269 to your computer and use it in GitHub Desktop.
Save jathayde/335269 to your computer and use it in GitHub Desktop.
def index
@purchase = Purchase.new
end
# this page is loaded and is the root_path
def create
@purchase = Purchase.new(params[:purchase])
if @purchase.save
flash[:notice] = 'Thanks!'
else
flash[:error] = 'That didn\'t work, yo'
end
redirect_to(root_path)
end
Processing PurchasesController#create (for 127.0.0.1 at 2010-03-17 10:05:18) [POST]
Parameters: {"commit"=>"Submit", "purchase"=>{"zip"=>"12098", "buy"=>"yes", "why"=>"No reason", "email"=>"bobo@mlist.org"}, "authenticity_token"=>"Hcf09tKEVnW/+/wQ5l6GgJQcK3QFe6eQefuVKPDiFfU="}
Purchase Load (0.2ms) SELECT "purchases".id FROM "purchases" WHERE ("purchases"."email" = 'bobo@mlist.org') LIMIT 1
Redirected to http://localhost:3002/
Completed in 16ms (DB: 0) | 302 Found [http://localhost/purchases]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment