def restore_download_delete_file
begin
case params[:submit]
when "restore"
restore_status = restore_file(params[:file_names])
raise if restore_status != 0
flash[:notice] = "File Successfully Restored."
redirect_to :action => "database_settings"
when "download"
download_status = download_file(params[:file_names])
raise if download_status != 0
when "delete"
delete_status = delete_file(params[:file_names])
raise if delete_status != 0
flash[:notice] = "File Successfully Deleted."
redirect_to :action => "database_settings"
end
rescue Exception => e
flash[:error] = "Error with #{params[:submit]}! Please retry."
redirect_to :action => "database_settings"
end
end
我該如何改進這種方法?我該如何幹燥這種方法?
它看起來不錯,但我不想在任何頁面上重定向下載場景。 – 2011-03-28 12:48:51
下載支票已添加重定向 – Ashish 2011-03-28 12:51:58