Delegate your rails javascript to object oriented classes from your controller.