What is the most Idiomatic way to build new/edit forms (controller backed) today?


#1

I’ve been looking at some older ember code recently and realized that a ton of my controller code could/should (maybe) be in the model itself. I’m curious how much logic other people are putting in the controller and what role the model has (as part of the controller when proxied up). As most of the model validation could just as easily live outside the controller making reuse easlier/helping keep the controller small(er).

This might also be a 2 part question because I find the new or create controllers are slightly different today in ember 1.8 land when compared to the edit controller. For example, in the edit scenario, I’m handed a fully hydrated model from the route so I can just proxy to it and boom -all my validation logic is model backed. The problem with the new/create form is that unless I write a route and return a “newly initialized model” I don’t have a hydrated model at all and usually find myself /other JR devs writing duplicate (ish) logic in the controller.

Any advise for ember 1.x would be helpful -thank you in advance!