Refactor/upgrade to rails 4