Created
October 14, 2012 09:40
-
-
Save rxqd/3888116 to your computer and use it in GitHub Desktop.
Controller action as big logic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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