Rails: Cookies, Frozen Gems, and TextDrive

Jon Steinhorst once told me a movies are rewritten from script to shoot, and again from shoot to editing. I spent a good chunk of this week re-writing a Ruby on Rails app to go from development to production.

Works fine in development. Not at all in production.

The issue was a combination of frozen gems and cookies.

First off, while TextDrive recommends depending on your vendor directory for any Ruby gems unique to your project, I found success with Geoffrey Grosenbach‘s Freeze Other Gems Rake task that sends them to /lib

Secondly, I wasn’t able to reliably set and retrieve cookies. Turns out I needed to access the cookie with a string, not a symbol.

All the resources I found say this should work in the controller

But it doesn’t, this does:

Then in the view (specifically a select menu) I need to use this: