ruby refactoring - passing logic to controllers