Port code from Rails 3.x app