Skip to content

Instantly share code, notes, and snippets.

@michellemhey
Last active August 29, 2015 14:00
Show Gist options
  • Save michellemhey/11404129 to your computer and use it in GitHub Desktop.
Save michellemhey/11404129 to your computer and use it in GitHub Desktop.
this is the code thats supposed to go in the file
def index
respond_to do |format|
format.text do
headers["Content-Type"] = "text/plain"
headers["Content-disposition"] = 'attachment; filename="users.txt"'
erroneous_call_to_proc = false
self.response_body = proc { |response, output|
unless erroneous_call_to_proc
User.find_each do |u|
output.write "#{u.name} #{u.email}\n"
end
end
erroneous_call_to_proc = true
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment