I've got this index
method in my 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
How can I render the html
version of my index action if there are more than 100 tasks?
My code above doesn't work. Instead of redirecting and showing a flash message, it downloads the html
file. I don't understand why. Please help me if you can.