Skip to content

Instantly share code, notes, and snippets.

@aibrahim
Created December 30, 2010 12:50
Show Gist options
  • Save aibrahim/759758 to your computer and use it in GitHub Desktop.
Save aibrahim/759758 to your computer and use it in GitHub Desktop.
respond_to do |format|
if verify_recaptcha(:model => @product, :notice => "error with reCAPTCHA!")
if @product.save
format.html { redirect_to(@product, :notice => 'Product was successfully created.') }
format.xml { render :xml => @product, :status => created, :location => @product }
else
format.html { render :action => "new" }
format.xml { render :xml => @product.errors, :status => :unprocessable_entity }
end
else
respond_to do |format|
format.html { redirect_to(new_product_path, :notice => 'error with reCAPTCHA!') }
format.xml {render :xml => @product.errors, :status => :unprocessable_entity }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment