Last active
August 29, 2015 14:00
-
-
Save michellemhey/11404129 to your computer and use it in GitHub Desktop.
this is the code thats supposed to go in the file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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