Skip to content

Instantly share code, notes, and snippets.

@thatrubylove
Created April 17, 2014 22:05
Show Gist options
  • Save thatrubylove/11014153 to your computer and use it in GitHub Desktop.
Save thatrubylove/11014153 to your computer and use it in GitHub Desktop.
an-exercise-in-refactoring-large-methods-in-ruby-example-1
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