Ruby On Rails: How to check if a csv file is downloaded -


i have download button in view form, use "index" action in controller

def index   respond_to |format|     format.html { @some_variables = some_variables.page(params[:page]) }     format.csv {       render csv: some_variables, headers: somevariable.csv_headers     }   end end 

and def self.to_csv method in model somevariable, in generate csv file.

is there anyway check if download ok , example set flag. if download went ok else raise error end

i thought "begin rescue" in index action, if there other "smarter" implementation sharing more appreciated.

send_file can alternative you're planning do. can find more information here how download file send_file? , @ api dock


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -