send_file and Zero byte files
Turns out, a default behaviour changed in Rails 3, with :x_sendfile now defaulting to true. This will give you zero byte file downloads in production with send_file. :-p So, remember to configure mod_xsendfile on your Apache, or specify :x_sendfile as false (not recommended) or use send_data.
Handy Snippet - one liner to dump data to a file
Note. Don’t try to dump a set of ActiveRecords with to_yaml this way. Doesn’t quite work, but I recommend you use rails console and try it, just to see why. It’ll be educational.
Dump ActiveRecords to YAML
This is what you need, to dump some ActiveRecords to YAML, assuming you want to do something like what I did, and get some quick and easy fixtures to use in your tests/specs:
Sorry I didn’t have much this week. We delivered a production release on one project, then spent time nailing down requirement details for the next sprint’s stories. On my Rails 2.x project, I was mostly trawling the warehouse database for new data, and updating the database we use for development, to mimic the warehouse.