Paginate. Get one of the more efficient pagination plugins, traverse the pagination yourself and load N rows at a time, while writing the CSV to either disk, or to send_file().
50.000 ActiveRecord objects in memory might not be the best of things.
Keep up to date with Rails on Twitter and This Week in Rails
Policies: Conduct, License, Maintenance, Security, Trademarks