Use send_file to download ini file


I need to create a Ruby method to be able to create an ini file and download it afterwards. I manage to create the file with (path, “w”) and File.puts “xxxxx” but when I try to download it with send_file (path) I have an error (NoMethodError: undefined method ` send_data 'for main: Object).
I would like to have an example to download a file.