Move sorting state to Rails controller from Angular controller.