Skip to content

Instantly share code, notes, and snippets.

@dmons
Created March 20, 2015 15:54
Show Gist options
  • Save dmons/483ecbf7915a4c168df4 to your computer and use it in GitHub Desktop.
Save dmons/483ecbf7915a4c168df4 to your computer and use it in GitHub Desktop.
Refactor controller's code.
def update
if params[:credit_card]
#process order
response = @order.process(params)
if response[:status] == "success"
render :template => "orders/show"
else
render :json => response
end
else
if params[:shipping_contact].size > 0 && params[:shipping_address].size > 0
@order.create_shipping_contact(params[:shipping_contact],params[:shipping_address])
end
render :template => "orders/show"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment