Rails 4

Adds Rails 4 support. Due to several changes in how Rails 4 handles cookies and secrets, this will NOT work with Rails 3.

(This branch also includes the user group code from the other branch)