I'm having a bit of trouble understanding the conceptual relationship between controllers and routes in an Ember application.
I've started down the path of a pretty simple spike test to evaluate Ember, and the deeper I get into it, the more I'm seeing my routes fill up with what I'd have through should be the controller's responsibility, such as actions, wiring up models, and ultimately dispatching to a view to render a template.
The controllers are all empty, and seem to be just a placeholder for some auto-mapping requirement.
Am I missing a fundamental thing here - coming from a Rails perspective, and applying (perhaps erroneously) the "rails way" to Ember I expected my routes to define states that are represented by URLs, which would map to a controller "action".
Any pointers would be much appreciated.
While the model classes handle the objects and their state, the controller handle the state of the application itself.
A very simple use case could be that you have two states for a form: readonlyMode and modifyMode. This belongs clearly not into the model where the actual objects are defined. It is just a state of your application.
If the controller says that the state is readonlyMode, the view will render all input fields as disabled. The reverse goes for the modifyMode.
But I agree that is not always easy to decide where to put it. At then end, MVC is about concepts. Having to to put it into some kind of rules, I would say:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With