我有这个index
方法在我的TasksController
:
def index
@tasks = current_account.tasks
@count = @tasks.length
respond_to do |format|
format.html do
...
end
format.zip do
if @count > 100
flash[:notice] = "Please reduce the number of tasks!"
redirect_to :action => "index", :format => "html"
else
DownloadArchive.call(@tasks)
end
end
end
end
html
如果有超过 100 个任务,我如何呈现我的索引操作的版本?
我上面的代码不起作用。它不是重定向和显示闪存消息,而是下载html
文件。我不明白为什么。如果可以,请你帮助我。