I have a download button in my view form, which use an "index" action in the controller
def index
respond_to do |format|
format.html { @some_variables = some_variables.page(params[:page]) }
format.csv {
render csv: some_variables, headers: SomeVariable.csv_headers
}
end
end
And some def self.to_csv method in my model SomeVariable, in which I generate the CSV file.
Is there anyway to check if the download was OK and for example set a flag. if download went OK do something else raise some error end
I thought about "begin rescue" in a index action, but if there is any other "smarter" implementation sharing it would be more than appreciated.