Skip to content

Instantly share code, notes, and snippets.

@rxx
Created October 14, 2012 09:40
Show Gist options
  • Save rxx/3888116 to your computer and use it in GitHub Desktop.
Save rxx/3888116 to your computer and use it in GitHub Desktop.
Controller action as big logic
def destroy
ip_address = Onapp::IpAddressJoin.find params[:id]
virtual_machine = ip_address.virtual_machine
path = virtual_machine_ip_address_joins_path(virtual_machine)
result = ip_address.api_delete
if result.body.errors
redirect_to(path, alert: result.body.errors.join(', '))
else
vm.reboot if params[:need_reboot]
redirect_to path, notice: t('controller.success.delete')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment