As my Ember apps grow, I’ve found myself having trouble trying to decide where to put actions that call save/destroy on a model.
The basic guidance of “routes handle model loading” and “controllers handle template state” would suggest state changes should happen in controller actions and then bubble to route for saving if necessary.
Sometimes, though, I have an isolated controller/template coupling that is rendered in a few different templates, loaded by different routes. If I have to save that model, I either need to:
- Put the saving in the controller, thus breaking MVC responsibilities
- Repeat the action across routes and extract to a mixin
Has anyone arrived at what they consider a consistent best practice for these types of actions?